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

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

问题描述

我正在参加一门课程,要求我为 Linux 编写一些 C++ 应用程序.我真的非常不喜欢 Linux 下可用的开发工具,但我喜欢 VS2010.

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.

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

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?

推荐答案

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

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天全站免登陆