vendredi 30 octobre 2015

how can cocos2dx 2.2.6 support c++ 11

I develop a project with cocos2d-x 2.2.6 on Mac OS 10.11.1 ,X-code 7.1 . All configuration are default. I need include header files such as <thread>, <mutex>, when I build the project I got an error , "'thread' file not found "。I googled this error then I realized that I have to update my X-code configuration to support c++11 .I modified some configuration as bellow:

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)

Today I create a total new project, I won't change a word,the project run fine. but when I modify configuration, the errors show again.

I need the project support c++ 11 . How can I fix this . I have been troubled by this problem for days. Am I miss some library? thank you very much. I will be online all the time.

Aucun commentaire:

Enregistrer un commentaire