Visual Studio 11 support?


#1

Has someone managed to compile JuceDemo under Visual Studio 11?
I am getting these errors:

Error 13 error C1189: #error : keyword defined before including C++ standard header c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h 124

I know its not officially supported, I was just messing with it.


#2

There’s no reason why it wouldn’t work. That error has nothing to do with juce though, it’s an MS header file!


#3

http://www.itk.org/pipermail/insight-users/2011-December/043177.html

It seems like this header file checks for redefinition of reserved words; maybe Microsoft added more words to that list?
Here’s a paste of the relevant part: http://pastebin.com/xrZSrpES

Edit:Found the culprit in juce_PlatformDefs.h:

#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_NOEXCEPT) #define noexcept throw() #endif

Also in stream_decoder.cpp:

#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ #define fseeko fseek #define ftello ftell #endif
_MSC_VER is now 1700…

Also, before you can even try to build, this is what happens:

To resolve this issue you can either ‘Update VC++ Projects’ or just install Visual Studio 2010.
If you choose the option of installing Visual Studio 2010, it will compile, but when trying to start the compiled product, I get this messagebox:

[code]---------------------------
Microsoft Visual Studio

Unable to cast object of type ‘Microsoft.VisualStudio.Project.ConfiguredProjectCache1[Microsoft.VisualStudio.Project.Immutables.ImmutableHashMap2[System.String,System.Threading.Tasks.Task1[Microsoft.VisualStudio.Project.PropertyPages.PropertyPagesCatalog]]]' to type 'Microsoft.VisualStudio.Project.ConfiguredProjectCache1[Microsoft.VisualStudio.Project.Immutables.ImmutableHashMap`2[System.String,Microsoft.VisualStudio.Project.PropertyPages.PropertyPagesCatalog]]’.

OK
---------------------------[/code]
Probably some incompatibility between VS11 debugger and VS10 build tools.

I upgraded the projects and now I have JuceDemo running under Visual Studio 11 and Windows 8 Consumer Preview :slight_smile:


#4

To sum it up for future IntroJucer compatibility:
[list=1]
[]in juce_PlatformDefs.h, change the line #if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_NOEXCEPT) to #if ! ((DOXYGEN || JUCE_COMPILER_SUPPORTS_NOEXCEPT) && _MSC_VER < 1700)[/]
[]in stream_decoder.cpp change line #if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ to #if _MSC_VER <= 1700 || defined __BORLANDC__ /* @@@ [2G limit] */[/]
[]Produce vcxproj files which uses build tools v110 (have no idea how to do it but I figure you’ve got a clue).[/][/list]

This should probably be enough :slight_smile:


#5

Thanks!

The whole point of that JUCE_COMPILER_SUPPORTS_NOEXCEPT flag is to detect whether noexcept is a keyword, so it’d be better to actually set the flag correctly! e.g. in juce_PlatformDefs.h, line 300:

#if defined (_MSC_VER) && _MSC_VER >= 1600 #if _MSC_VER >= 1700 #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1 #else #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 0 #endif #define JUCE_COMPILER_SUPPORTS_NULLPTR 1 #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1 #endif

?

But the changes to stream_decoder look sensible, thanks!


#6

No problem. I will update the NOEXCEPT part.
Any chance of seeing IntroJucer support anytime soon?


#7

I’ll support it soonish, but doesn’t it import the VS2010 projects?


#8

It does, but I want to work with someone who uses VS10 and the Upgrade VC++ Projects changes them to require VS11.


#9

I ran into the same issue with VS11:

#error : keyword defined before including C++ standard header c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h 124

and i solved in a very blunt way by just commenting out line 90 in xkeycheck.h

After that the JuceBrowserPluginDemo compiled just fine.

But other projects gave a huge amount of these error messages:

error C3646: ‘noexcept’ : unknown override specifier

So i added the line “#define noexcept throw()” in juce_PlatformDefs.h at line 302

Here is the code starting from line 300:

#if defined (_MSC_VER) && _MSC_VER >= 1600 #if _MSC_VER >= 1700 #define noexcept throw() #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1 #else #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 0 #endif #define JUCE_COMPILER_SUPPORTS_NULLPTR 1 #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1 #endif