Solve a small problem with compilation in Cocos2d-x
for Cocos2d-x 2.x in the compilation, if the header file introduced the # include "Cocos-ext.h", in the C + + compilation will encounter the following error:
Undefined reference to symbol ' [email protected] @GLIBC_2.2.5 '/lib/x86_64-linux-gnu/libpthread.so.0:error adding Symbols:dso Missing from command line
Google on the internet for a long time, some people said to modify the source code in the cocos2dx.mk of some configuration, I said that after the change or the old problem, in the official web search is also such an answer, seemingly modified cocos2dx.mk can, but I always did not solve.
Attach the official solution: Click the Open link, as follows
Finally find a solution in the forum, the simplest way.
In Linux under the development of C + + Cocos2d-x need to use the makefile file, directly in the Proj.linux can find makefile file, open the file will see the original configuration, solve the above compilation problem directly modify the configuration in $log_link
The original connection is as follows:
$ (Log_link) $ (CXX) $ (cxxflags) $ (OBJECTS)- o [email protected] $ (sharedlibs) $ (staticlibs)
The following changes are followed:
$ (Log_link) $ (CXX) $ (cxxflags) $ (OBJECTS)-wl,--no-as-needed-o [email protected] $ (sharedlibs) $ (staticlibs)
That is to add the-wl,--no-as-needed, these two key points.
The recompile is passed correctly.