c++ - Boost python 和 Mac Mavericks

标签 c++ python boost-python osx-mavericks

我刚刚将我的 Mac OS 更新为 Maverick,它似乎损坏了某些东西!

我正在编写 C++ 代码并使用 boost.python 编写 Python 前端。升级前我有工作代码,升级后我开始收到一个奇怪的链接错误:

darwin.link.dll /Users/Andy/software/boost-1.54.0/bin.v2/libs/python/build/darwin-4.8.1/debug/libboost_python.dylib 
Undefined symbols for architecture x86_64: 
  "std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::size() const", referenced from: 
      boost::python::converter::(anonymous namespace)::wstring_rvalue_from_python::extract(_object*) in builtin_converters.o 
  "std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::empty() const", referenced from: 
  boost::python::converter::(anonymous namespace)::wstring_rvalue_from_python::extract(_object*) in builtin_converters.o 
  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::data() const", referenced from: 
  boost::python::converter::arg_to_python<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::arg_to_python(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in numeric.o 

.... 页面和类似错误的页面。有谁知道发生了什么事吗?

最佳答案

在切换到 Mavericks 之前,您在哪里使用 Xcode 5?

您可以尝试将项目使用的标准库版本更改为 Xcode 的 LLVM 编译器中的默认版本,从 C++98 切换到 C++11。

要检查它,请进入 xcode 中的目标设置,“build设置”选项卡和“Apple LLVM 5.0 - 语言 - C++”更改:

  • 从“编译器默认”到“GNU++98”的 C++ 语言方言
  • C++ 标准库从“编译器默认”到“libstdc++(GNU C++ 标准库)”

关于c++ - Boost python 和 Mac Mavericks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19635240/

相关文章:

python - 我正在制作一个打地鼠游戏,当用户点击地鼠图像时,他会得到一个分数。我不知道如何实现这一点

c++ - 使用 boost.python 返回内部引用的间歇性错误

c# - 像在 C# 中一样在 C++ 中绑定(bind)

python - 保存绘图时更改 Matplotlib 图窗口的分辨率?

c++ - 覆盖boost中的验证方法不适用于样式集

python - 在 Python 中循环后可靠地读取循环变量

c++ - 使用 boost.python 从 UTF-8 编码的 char* 返回 python unicode 实例

c++ - 如何在boost python中公开派生类函数

c++ - 使用 ubuntu 终端在 c++ 上运行线程类的问题

c++11:clang 在我的模板定义中拒绝 numeric_limits<>,而 gcc 接受它 - 这是正确的吗?