[Centos] How to Solve GCC version conflicts?

Source: Internet
Author: User

Today, I encountered a problem that is quite difficult. On centos, I used Yum to install the compiling environment and run:

Yum-y install make GCC gcc-C ++ kernel-devel M4 ncurses-devel OpenSSL-devel

As a result, the compilation cocos2d-x has an error:

cc1plus: error: unrecognized command line option "-std=c++11"

I Googled and confirmed that this error was caused by a low GCC version.

View the GCC version:

GCC -- version

System display:

GCC (GCC) 4.8.2

I googled again and confirmed that this version supports C ++ 11.

But the compilation error for the cocos2d-x does occur after the yum command is run.

I searched GCC globally:

Find/-name gcc

There are so many GCC:

/Usr/lib/GCC
/Usr/local/lib/GCC
/Usr/local/bin/GCC
/Usr/local/libexec/GCC
/Usr/bin/GCC


Run again:

/Usr/bin/GCC -- version

GCC (GCC) 4.4.7-4


/Usr/local/bin/GCC -- version

GCC (GCC) 4.8.2


It seems that there are indeed two GCC instances on this machine. The shell runs/usr/local/bin/GCC, but cocos2dx make uses/usr/bin/GCC (why is the path inconsistent? The reason is unclear)

The solution is run;

MV/usr/bin/GCC/usr/bin/gcc4.4.7

Ln-S/usr/local/bin/GCC/usr/bin/GCC


In addition, the commands g ++, CC, and C ++ should also be modified.

MV/usr/bin/g ++ 4.4.7

Ln-S/usr/local/bin/g ++/usr/bin/g ++


MV/usr/bin/CC/usr/bin/cc4.4.7

Ln-S/usr/local/bin/CC/usr/bin/CC


MV/usr/bin/C ++ 4.4.7

Ln-S/usr/local/bin/C ++/usr/bin/C ++




Related Article

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.