简体   繁体   English

Visual C ++的设置/选项/标志与g ++中的-ansi -pedantic对应

[英]What Visual C++ setting/option/flag is the counterpart of -ansi -pedantic in g++

I have a C++ codebase, and I am porting from Visual Studio to g++, which should I set in Visual Studio so that build errors in gcc are reduced? 我有一个C ++代码库,并且正在从Visual Studio移植到g ++,我应该在Visual Studio中进行设置,以减少gcc的生成错误? With g++ this is achieved by -ansi -pedantic. 对于g ++,这是通过-ansi -pedantic实现的。

我相信您正在寻找/ Za

You should probably set the highest warning level /W4 and also disable the MS specific language extensions, /Za. 您可能应该设置最高警告级别/ W4,并禁用MS特定语言扩展名/ Za。 Also check that you're using the for loop scope option /Zc:forScope 还要检查您是否使用了for循环范围选项/ Zc:forScope

The only real way to do this is to compile under VStudio AND under GCC. 唯一的真正方法是在VStudio和GCC下进行编译。 GCC can be a lot more pedantic than VStudio :) GCC 可以比VStudio多很多迂腐:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM