Com*_*ist 14 c++ xcode boost makefile cmake
我为提出这样一个共同的问题而道歉; 我找不到任何有效或足够清晰的解决方案供我实施.我只是想安装mgiza.这是INSTALL文件:
cmake .
make
make install
If you want to install to a custom location, add the following flag when you run cmake:
-DCMAKE_INSTALL_PREFIX=/path/to/custom/location
NOTE: Boost Version 1.48 has problem with the code, you can use either 1.46 or 1.50+. Unfortunately 1.48 is shipped with Ubuntu 12.04 LTS, you can either download and compile libboost 1.50+ from their website, or just do this:
sudo apt-get install libboost1.46-all-dev
Run Code Online (Sandbox Code Playgroud)
看起来很简单吧?打字cmake .工作没有任何明显的问题.不幸的是,make遇到了这个可怕的错误("未定义的符号......").
1 warning generated.
Linking CXX executable ../bin/d4norm
Undefined symbols for architecture x86_64:
"std::string::_Rep::_M_destroy(std::allocator<char> const&)", referenced from:
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o)
"std::string::_Rep::_S_empty_rep_storage", referenced from:
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o)
"std::string::assign(char const*, unsigned long)", referenced from:
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)", referenced from:
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()", referenced from:
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
基于其他问题,这是Mavericks的问题,因为它使用clang来编译c ++代码,这意味着库是libc ++,而不是libstdc ++.为了完整性,以及其他人可以重现我的错误,我使用OS X 10.9.5,Xcode 6.1,我的升级版本是1.56(通过自制软件安装了boost).
现在,必须有一些修复,对吧?让我们来看看其中一些:
make命令中?我尝试过这样做make -stdlib=libstdc++,虽然这似乎避免了上述错误,但它引入了一些额外的错误:( make: *** [all] Error 2不确定这意味着什么).LIBS += [...] boost排队.g++但我使用的是没有g++任何地方的Makefile .cmake和make......cmake/ make到gcc.(注意:从这一点开始,我将忽略通过向gcc或g ++添加内容而回答的大多数问题.)所以我对如何正确安装mgiza感到有点失落......我的意思是,mgiza的全部意义在于给予我,cmake并且make我不必担心编译事物的混乱细节,对吧?然而,这不仅仅是一个mgiza问题,因为我在尝试make其他地方时遇到了这个问题.我理解(C)Makefiles的高级思想,但不是低级细节.
针对评论者的一些担忧:处理此问题的最佳方法是尝试尽可能地清理您的系统并从头开始该过程。
另外,自从这篇文章发布以来,OS X 10.10 Yosemite 已经发布,这可能已经解决了这个问题(IIRC 这个问题主要是由于 10.9 和 clang/gcc 编译器的更改)。
| 归档时间: |
|
| 查看次数: |
11079 次 |
| 最近记录: |