我正在尝试在项目中使用CGAL。我已经使用brew安装了CGAL:
brew install cgal
然后,我尝试运行一些简单的代码。我正在尝试运行此网页的第一个代码:
https://doc.cgal.org/4.7-beta1/Manual/introduction.html
我尝试使用以下命令来编译代码:
g++ -lcgal points_and_segment.cpp -o points_and_segment
但是我收到此错误:
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)
我尝试在命令中包含-lboost或-lboost_thread。但是随后出现以下错误:
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)
我用-v尝试了同样的方法。然后我得到以下信息:
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)
我一直在寻找cgal安装文件夹。这是我机器中的以下路径:
cd /usr/local/opt/cgal/
用于增强的文件夹是:
cd /usr/local/opt/boost/
.brew/ INSTALL_RECEIPT.json include/ lib/