简体   繁体   English

在mac中运行CGAL代码时出现编译错误

[英]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.

相关问题 在 Xcode 中运行 Mac Catalyst 应用程序时出现错误代码 -10670 - Getting error code -10670 when running a Mac Catalyst app in Xcode Mac OS X上的C代码编译错误 - c code compilation error on mac OS X 使用 Mac Mojave 和 brew 安装 cgal-swig-bindings,之后找不到错误符号:_PyClass_Type - installing cgal-swig-bindings with Mac Mojave and brew, after that getting the Error Symbol not found: _PyClass_Type 出现错误 npm ERR! 运行 npm 时安装代码 EUNSUPPORTEDPROTOCOL - Getting error npm ERR! code EUNSUPPORTEDPROTOCOL while running npm install Java编译错误:Mac - Java compilation error: Mac 我在mac OS上的visual studio代码中编译c#代码时遇到错误 - i am getting an error while compiling c# code in visual studio code on a mac OS 在Mac上运行JavaFx应用程序时出错 - Error while running JavaFx application on Mac H2OServerError:服务器进程在运行 h2o.init() 时在 Mac 上的 Python 中以错误代码 1 终止 - H2OServerError: Server process terminated with error code 1 in Python on Mac while running h2o.init() Mac OS X 10.7 Lion中未编译CGAL程序(和示例) - CGAL Program (and Examples) Not Getting Compiled in Mac OS X 10.7 Lion 在 Mac 上安装 mysqlclient 时出错 - Getting error while installing mysqlclient on Mac
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM