Linux under development, to solve the Cocos2d-x in the compilation of a small problem, undefined reference to symbol ' pthread_create@ @GLIBC_2.2.5 '

Source: Internet
Author: User

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.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.