当我运行 g++ 时,它会抛出几个错误:
$ g++ SongStructure.cpp mtmtest.cpp Song.cpp examples/OldSongExample.cpp -std=c++11 -Wall -Werror -pedantic-errors -DNDEBUG -o example
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: error: unrecognized command line option "-std=c++11"
如何解决这个问题,为什么会这样?有人有想法吗?
最佳答案
您只是有一个不支持 C++11 标准的 g++ (gcc) 版本。你可以不使用 C++11(或者如果你不使用,则不要指定 -std=c++11
),尝试使用 -std=c++0x
当 C++11 处于实验阶段并被命名为 C++0x 时,一些旧版本的 GCC 支持它,或者升级你的编译器。
关于c++ - 在 SSH Secure Shell c++ 中编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14410596/