Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试过用谷歌搜索,但我得到的只是如何编译基本程序的结果。是否可以通过指定代码应编译为 C89、C99、C++98 等来使用 Clang++ 和 G++ 将代码编译为特定的 C++ 标准?
您可以使用 -std 标志。例如,要编译为 C99,请使用-std=c99
-std=c99
它的文档在这里
像这样使用-std标志:
-std
g++ -std=c++98 -o myprog myprog.cpp -lfoo
这是一个包含大量 GCC/G++ 选项的手册页,包括这个。