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.
我正在使用 Eclipse 编写 C/C++ 程序。我想使用 -Wall 和 -pedantic 标志编译我的代码。如何在 Eclipse 中启用这些标志,以便在编译 C/C++ 程序时默认使用它们?
转到 Eclipse -> 项目资源管理器 -> 你的项目 -> 上下文菜单 -> 属性。
出现一个对话框。在左侧窗格中,打开“C/C++ 构建”-> 设置。在右窗格中,确保选择选项卡“工具设置”-> 在“GCC C++ 编译器”下选择“警告”-> 选中所需的框。
在你的情况下,你想要“迂腐(-pedantic)”。默认情况下,“所有警告(-Wall)”应该已经被选中。您可能还需要“额外警告 (-Wextra)”(别名“-W”)。