VS2010 C和C ++ - 强制执行符合Linux / gcc兼容性的ANSI标准? [英] VS2010 C and C++ - enforce ANSI compliance for Linux/gcc compatibility?

查看:253
本文介绍了VS2010 C和C ++ - 强制执行符合Linux / gcc兼容性的ANSI标准?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在上一门课,我需要为Linux编写一些C ++应用程序。我真的很不喜欢Linux下可用的开发工具,但我喜欢VS2010。

是否有任何类型的编译器开关可以在VC ++中强制执行A​​NSI或gcc兼容性?或者我可以将编译器替换为gcc并仍然使用VS环境?

解决方案

您可以禁用Microsoft扩展到ANSI C和ANSI C ++标准,通过指定 / Za 标志,如果您使用非标准的C和C ++功能,将会使编译器发出错误。



http:// msdn.microsoft.com/en-us/library/0k0w269d(v=VS.100).aspx



然而,这并不排除你从使用特定于平台的头文件。


I'm taking a class in which I'm required to write some C++ apps for Linux. I really, really dislike the dev tools available under Linux, but I love VS2010.

Is there any sort of compiler switch which will enforce ANSI or gcc compatibility in VC++? Or can I swap the compiler out for gcc and still use the VS environment?

解决方案

You can disable Microsoft extensions to the ANSI C and ANSI C++ standards by specifying the /Za flag, which will make the compiler emit errors if you use non-standard C and C++ features.

http://msdn.microsoft.com/en-us/library/0k0w269d(v=VS.100).aspx

However, this doesn't preclude you from using platform specific headers.

这篇关于VS2010 C和C ++ - 强制执行符合Linux / gcc兼容性的ANSI标准?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆