简体   繁体   中英

Does _MSC_VER depend on toolkit version?

I'm writing a Ruby C Extension against Ruby libs that where compiled with Visual Studio 2010. (I cannot change this, or recompile the Ruby core I'm building against, because it's embedded in a third party application.)

My project started out in Visual Studio 2010, but I later started using Visual Studio 2013 without upgrading the project - so it's still using the VS2010 toolkit.

In the Ruby include headers that I need to use there is a check:

#if _MSC_VER != 1600
#error MSC version unmatch: _MSC_VER: 1600 is expected.
#endif

Now, I thought since I was using the VS2010 toolkit for my project this check would still pass in VS2013. And this is where I'm confused:

The solution builds and creates the .so file which works, there is no warnings or errors in Output, but I just discovered that the Error List displayed a warning. IntelliSense will display 1800 for _MSC_VER - yet it compiles.

1   IntelliSense: #error directive: MSC version unmatch: _MSC_VER: 1600 is expected.    c:\Users\Thomas\Documents\subd\ThirdParty\include\ruby\win32\i386-mswin32_100\ruby\config.h 4

MSC版本不匹配:_MSC_VER:预期为1600

So what is going on here?

Isn't Visual Studio using the VS2010 compiler when my toolkit is set to v100 ? (Then I'd expect _MSC_VER to be 1600 .)

Is the #warning directive not something that blocks the compiler?

Is it IntelliSense that isn't picking up the toolkit version and instead always assume _MSC_VER is 1800 ?

_MSC_VER is directly tied to a toolkit, not the IDE.

The buggy Intelisense also behaves the same in VS2012 (with Vs2010 toolkit)...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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