简体   繁体   English

CGAL编译/链接器错误

[英]CGAL Compile / Linker Error

I'm trying to set up CGAL in Nvidia's Nsight Eclipse studio (Eclipse CDT). 我正在尝试在Nvidia的Nsight Eclipse工作室(Eclipse CDT)中设置CGAL。 I don't plan on using it with CUDA, however I will need to use it for another part of a project that I am working on. 我不打算将它与CUDA一起使用,但是我需要将其用于我正在研究的项目的另一部分。

The error I am getting is this: 我得到的错误是这样的:

/home/me/work/x64_linux/cgal/include/CGAL/GMP/Gmpq_type.h:62: 
undefined reference to `__gmpq_init'

This is followed by several other identical errors regarding gmpq. 其次是有关gmpq的其他几个相同的错误。 I think it's a linking issue, but as far as I am aware, I'm not sure where I went wrong. 我认为这是一个链接问题,但是据我所知,我不确定我哪里出错了。 My other dependencies link fine. 我的其他依赖项链接很好。 I installed CGAL through apt-get, and followed the set-up instructions given in the manual. 我通过apt-get安装了CGAL,并按照手册中的设置说明进行了安装。 Perhaps I went wrong somewhere there, but long story short, I'm pretty lost in regards to getting this to work! 也许我在那儿某个地方出了错,但长话短说,就让它工作起来我很失落! Any help / tips are appreciated! 任何帮助/提示表示赞赏!

EDIT: Here is the solution, for anyone in the future that might stumble across this question. 编辑:这是解决方案,对于将来可能偶然遇到此问题的任何人。

For some reason, the IDE was referencing the library incorrectly, despite my inputs being correct. 由于某些原因,尽管我的输入是正确的,IDE还是错误地引用了库。 I simply opened a new project and migrated my files over. 我只是打开了一个新项目,然后将文件迁移了过来。 Adding libraries follows the standard procedure in Eclipse: Go to Project Properties -> Paths and Symbols. 添加库遵循Eclipse中的标准过程:转到项目属性->路径和符号。 Add the path to the directory the library is located under to library paths, and add the library name to libraries. 将路径添加到库位于库路径下的目录中,并将库名称添加到库中。

  1. Make sure that when you are compiling your code, you should be passing a -l option to the compiler to link to CGAL 确保在编译代码时,应将-l选项传递给编译器以链接到CGAL
  2. If you are passing a -l option to the compiler, make sure that either the CGAL library is accessible from a folder in your path or that you are passing the full path to the CGAL library. 如果你传递一个-l选项编译器,确保无论是CGAL库是在你的路径从文件夹访问或要传递的完整路径CGAL库。

There isn't much more I can say without seeing your build setup. 在没有看到您的构建设置的情况下,我无话可说。

Here is the solution, for anyone in the future that might stumble across this question. 对于将来可能偶然遇到此问题的任何人,这都是解决方案。

For some reason, the IDE was referencing the library incorrectly, despite my inputs being correct. 由于某些原因,尽管我的输入是正确的,IDE还是错误地引用了库。 I simply opened a new project and migrated my files over. 我只是打开了一个新项目,然后将文件迁移了过来。 Adding libraries follows the standard procedure in Eclipse: Go to Project Properties -> Paths and Symbols. 添加库遵循Eclipse中的标准过程:转到项目属性->路径和符号。 Add the path to the directory the library is located under to library paths, and add the library name to libraries. 将路径添加到库位于库路径下的目录中,并将库名称添加到库中。 If you need clarification, please ask. 如果需要澄清,请询问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM