小编pan*_*nda的帖子

CGAL 编译器错误:未定义引用`CGAL::assertion_fail(char const*, char const*, int, char const*)'

我是 CGAL 的新手,我在 Ubuntu 16.04 上使用 CGAL 4.7-4。我正在尝试编译并运行一个非常简单的 .cpp。这是代码:

#include <iostream>
#include <CGAL/Cartesian.h>

int main()
{
 int p=2;
 std::cout << "hello " << p << std::endl;
 return 0;
}
Run Code Online (Sandbox Code Playgroud)

我添加了该行

#include <CGAL/Cartesian.h>
Run Code Online (Sandbox Code Playgroud)

因为我想看看如何编译更多的库。然后我在终端上写了这一行

g++ -lCGAL -lgmp prova.cpp
Run Code Online (Sandbox Code Playgroud)

但我收到了这个错误:

/tmp/cc9DA7Ml.o:在函数'CGAL::Interval_nt::Test_runtime_rounding_modes::Test_runtime_rounding_modes()'中:

prova.cpp:(.text._ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC5Ev]+0xd2):对'CGAL::(*)const_fail char的未定义引用

prova.cpp:(.text._ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC5Ev]+0x180): 未定义的引用 'CGAL char::*assertion, const_constf,

/tmp/cc9DA7Ml.o:在函数'CGAL::Interval_nt::Test_runtime_rounding_modes::Test_runtime_rounding_modes()'中:

prova.cpp:(.text._ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC5Ev]+0xd2):对'CGAL::(*)const_fail char的未定义引用

prova.cpp:(.text._ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC5Ev]+0x180): 未定义的引用 'CGAL char::*assertion, int_constf,

collect2: 错误: ld 返回 1 个退出状态

即使我写了以下任何一行,我也遇到了同样的错误:

g++ -lCGAL -lmpfr -lgmp prova.cpp

g++ -I/opt/local/include -L/opt/local/lib -lCGAL -lgmp prova.cpp

g++ -I/opt/local/include -L/opt/local/lib/ -lCGAL -lgmp prova.cpp

g++ -I/usr/include …
Run Code Online (Sandbox Code Playgroud)

linker compiler-errors g++ cgal

3
推荐指数
1
解决办法
2834
查看次数

标签 统计

cgal ×1

compiler-errors ×1

g++ ×1

linker ×1