首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CGAL编译错误

CGAL编译错误
EN

Stack Overflow用户
提问于 2017-07-26 02:02:19
回答 1查看 452关注 0票数 0

我安装了所有CGAL所需的库,并在linux上编译我的程序时将所有库路径添加到我的makefile中,但仍然出现编译错误。

这是我的makefile的内容

代码语言:javascript
复制
//--------------------------------------------------

FLAGS = -Wall -g -std=c++11 -O3 

BOOST_LIB_PATH = -I /usr/include/include/

CGAL_LIB_PATH = -I /usr/local/include/

all : 
    g++ $(FLAGS) $(BOOST) $(CGAL) main.cpp -o main
clean : 
    rm main

//--------------------------------------------------

贝娄是编译时的错误信息,请帮助!

代码语言:javascript
复制
//---------------------------------------------------- 

g++ -Wall -g -std=c++11 -O3  -I /usr/include/include/ -I /usr/local/include/ main.cpp -o main
/usr/local/include/CGAL/Interval_nt.h:208: undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/usr/local/include/CGAL/Interval_nt.h:210: undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/cc5WX5dM.o: In function `~Gmpz_rep':
/usr/local/include/CGAL/GMP/Gmpz_type.h:57: undefined reference to `__gmpz_clear'
/usr/local/include/CGAL/GMP/Gmpz_type.h:57: undefined reference to `__gmpz_clear'
/usr/local/include/CGAL/GMP/Gmpz_type.h:57: undefined reference to `__gmpz_clear'
/tmp/cc5WX5dM.o: In function `CGAL::Gmpz::operator==(CGAL::Gmpz const&) const':
/usr/local/include/CGAL/GMP/Gmpz_type.h:154: undefined reference to `__gmpz_cmp'
/usr/local/include/CGAL/GMP/Gmpz_type.h:154: undefined reference to `__gmpz_cmp'
/tmp/cc5WX5dM.o: In function `CGAL::Quadratic_program_solution<CGAL::Gmpz>::optimality_certificate_numerators_begin() const':
/usr/local/include/CGAL/QP_solution.h:460: undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/cc5WX5dM.o: In function `CGAL::Gmpz::operator<(CGAL::Gmpz const&) const':
/usr/local/include/CGAL/GMP/Gmpz_type.h:152: undefined reference to `__gmpz_cmp'
/usr/local/include/CGAL/GMP/Gmpz_type.h:152: undefined reference to `__gmpz_cmp'
/usr/local/include/CGAL/GMP/Gmpz_type.h:152: undefined reference to `__gmpz_cmp'
/tmCGAL::assertion_fail(char const*, char const*, int, char const*)'
collect2: error: ld returned 1 exit status
make: *** [all] Error 1
EN

回答 1

Stack Overflow用户

发布于 2022-06-21 07:19:45

我也有过类似的问题。我通过添加find_library( GMP_LIB名称"gmp“路径${CMAKE_LIBRARY_PATH} )来修复它,并将其添加到target_link_libraries中

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45316205

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档