[英]Getting compilation error while running CGAL code in mac
I am trying to use CGAL in a project. 我想在项目中使用CGAL。 I have installed CGAL using brew: 我用brew安装了CGAL:
brew install cgal
Then, I tried to run some simple code. 然后,我尝试运行一些简单的代码。 I am trying to run the first code of this webpage: 我正在尝试运行此网页的第一个代码:
https://doc.cgal.org/4.7-beta1/Manual/introduction.html
I have tried to compile the code using the following command: 我尝试使用以下命令编译代码:
g++ -lcgal points_and_segment.cpp -o points_and_segment
But I am getting this error: 但是我收到了这个错误:
Undefined symbols for architecture x86_64:
"boost::detail::get_tss_data(void const*)", referenced from:
boost::thread_specific_ptr<double>::get() const in points_and_segment-78cb9a.o
"boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)", referenced from:
boost::thread_specific_ptr<double>::reset(double*) in points_and_segment-78cb9a.o
boost::thread_specific_ptr<double>::~thread_specific_ptr() in points_and_segment-78cb9a.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried to include -lboost or -lboost_thread in the command. 我试图在命令中包含-lboost或-lboost_thread。 But then I am getting the following errors: 但后来我收到以下错误:
ld: library not found for -lboost
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: library not found for -lboost_thread
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried the same with -v. 我用-v尝试了同样的方法。 Then I get the following: 然后我得到以下内容:
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
"/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name points_and_segment.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 274.2 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/abureyanahmed/cgal_test -ferror-limit 19 -fmessage-length 143 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/vf/b6nrfcl95l56768gldg25r1m0000gn/T/points_and_segment-c5ee94.o -x c++ points_and_segment.cpp
clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin15.6.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1
/usr/local/include
/Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0/include
/Library/Developer/CommandLineTools/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o points_and_segment -lcgal -lboost /var/folders/vf/b6nrfcl95l56768gldg25r1m0000gn/T/points_and_segment-c5ee94.o -lc++ -lSystem /Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a
ld: library not found for -lboost
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have looked for the cgal installation folder. 我找了cgal安装文件夹。 It is the following path in my machine: 它是我机器中的以下路径:
cd /usr/local/opt/cgal/
The folder for boost is: boost的文件夹是:
cd /usr/local/opt/boost/
.brew/ INSTALL_RECEIPT.json include/ lib/
I struggled with this too. 我也在努力解决这个问题。 This website helped: 该网站帮助:
https://discourse.brew.sh/t/could-not-link-to-boost/2125/4 https://discourse.brew.sh/t/could-not-link-to-boost/2125/4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.