【问题标题】:how can cocos2dx 2.2.6 support c++ 11cocos2dx 2.2.6如何支持c++ 11
【发布时间】:2016-01-30 13:32:08
【问题描述】:

我在 Mac OS 10.11.1 ,X-code 7.1 上使用 cocos2d-x 2.2.6 开发一个项目。所有配置都是默认的。我需要包含头文件,例如<thread><mutex>,当我构建项目时出现错误,“找不到'线程'文件”。我用谷歌搜索了这个错误,然后我意识到我必须更新我的X代码支持c++11的配置。我修改了一些配置如下:

TARGET->Build Settings->Apple LLVM 7.0 - Language - C++
C++ Language Dialect => c++11[-std=c++11]
C++ Standard Library => c++11[-std=c++11]
[the configuration I modified][1]
I build the project after clean. then I got a lot of errors.  
[errors][2]

Errors like bellow :
"std::string::operator=(std::string const&)", referenced from:
cocos2d::CCLabelTTF::_prepareTextDefinition(bool) in libcocos2dx.a(CCLabelTTF.o)
"std::string::operator[](unsigned long)", referenced from:
"std::string::operator+=(char const*)", referenced from:
"std::string::operator+=(std::string const&)", referenced from:
"std::_List_node_base::hook(std::_List_node_base*)", referenced from:
"std::_List_node_base::unhook()", referenced from:
"std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream(std::string const&, std::_Ios_Openmode)", referenced from:
"std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream()", referenced from:
"std::ios_base::Init::Init()", referenced from:
"std::ios_base::Init::~Init()", referenced from:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

今天我创建了一个全新的项目,我不会改变一个字,项目运行良好。但是当我修改配置时,错误再次出现。

我需要项目支持 c++ 11 。我怎样才能解决这个问题 。我被这个问题困扰了好几天。我想念一些图书馆吗?非常感谢您。我会一直在线。

【问题讨论】:

    标签: multithreading c++11 mutex


    【解决方案1】:

    对不起,我犯了一个错误。 C++ 语言方言 => c++11[-std=c++11] C++ 标准库 => libc++(支持 C++11 的 LLVM C++ 标准库)

    【讨论】:

      猜你喜欢
      • 2011-06-30
      • 1970-01-01
      • 2012-11-29
      • 2017-09-11
      • 2013-06-10
      • 1970-01-01
      • 2017-01-13
      • 2011-12-20
      相关资源
      最近更新 更多