如何undefine _MSC_VER? [英] how to undefine _MSC_VER?
问题描述
我在Visual Studio工作,但我的项目是一个基于POSIX的环境(marmalade sdk)。在这个项目中,版本
build是使用gcc for ARM编译的,但是调试版本适用于windows并由MS编译器编译。此外,这个环境有自己的STL和其他标准库的实现。
I work in Visual Studio but my project is for a POSIX-based environment (marmalade sdk). In this project, the release build is compiled with gcc for ARM but the debug version works on windows and is compiled by MS compiler. Also this environmet has its own implementation of STL and other standard libraries.
这些c ++库中有许多都有这样的代码:
Many of these c++ librares have code like this:
#if defined( _MSC_VER )
#include <Windows.h>
#else
#include <pthread.h>
#endif
是否可以取消定义_MSC_VER宏? -
Is it possible to undefine the _MSC_VER macro? - So that the C++ libraries will detect a POSIX system here.
推荐答案
当然:
#undef _MSC_VER
#if defined( _MSC_VER )
#include <Windows.h>
#else
#include <pthread.h>
#endif
或者,#undef之前包括 _MSC_VER
。
Or, #undef it before you include the file where _MSC_VER
is used.
这篇关于如何undefine _MSC_VER?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!