cocos2dx 2.2.6如何支持c ++ 11

时间:2015-10-30 07:20:14

标签: multithreading c++11 mutex

我在Mac OS 10.11.1上使用cocos2d-x 2.2.6开发了一个项目,X-code 7.1。所有配置均为默认值。我需要包含<thread><mutex>等标题文件,当我构建项目时出现错误,&#34;&#39; thread&#39;找不到文件&#34;。我搜索了这个错误然后我意识到我必须更新我的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。我怎样才能解决这个问题 。这几天我一直困扰着这个问题。我想念一些图书馆吗?非常感谢你。我会一直在线。

1 个答案:

答案 0 :(得分:0)

抱歉,我犯了一个错误。 C ++语言方言=&gt; C ++ 11 [-std = C ++ 11] C ++标准库=&gt; libc ++(支持C ++ 11的LLVM C ++标准库)