Visual Studio 11 support?

9 posts / 0 new
Last post
Tsury
Offline
Last seen: 1 week 5 days ago
Joined: 12 May 2011 - 19:18
Visual Studio 11 support?

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.

jules
Online
Last seen: 7 min 57 sec ago
Joined: 29 Apr 2013 - 18:37
Re: Visual Studio 11 support?

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

Tsury
Offline
Last seen: 1 week 5 days ago
Joined: 12 May 2011 - 19:18
Re: Visual Studio 11 support?

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:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(34,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.

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:

---------------------------
Microsoft Visual Studio
---------------------------
Unable to cast object of type 'Microsoft.VisualStudio.Project.ConfiguredProjectCache`1[Microsoft.VisualStudio.Project.Immutables.ImmutableHashMap`2[System.String,System.Threading.Tasks.Task`1[Microsoft.VisualStudio.Project.PropertyPages.PropertyPagesCatalog]]]' to type 'Microsoft.VisualStudio.Project.ConfiguredProjectCache`1[Microsoft.VisualStudio.Project.Immutables.ImmutableHashMap`2[System.String,Microsoft.VisualStudio.Project.PropertyPages.PropertyPagesCatalog]]'.
---------------------------
OK   
---------------------------

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 :)

Tsury
Offline
Last seen: 1 week 5 days ago
Joined: 12 May 2011 - 19:18
Re: Visual Studio 11 support?

To sum it up for future IntroJucer compatibility:

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

This should probably be enough :)

jules
Online
Last seen: 7 min 57 sec ago
Joined: 29 Apr 2013 - 18:37
Re: Visual Studio 11 support?

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!

Tsury
Offline
Last seen: 1 week 5 days ago
Joined: 12 May 2011 - 19:18
Re: Visual Studio 11 support?

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

jules
Online
Last seen: 7 min 57 sec ago
Joined: 29 Apr 2013 - 18:37
Re: Visual Studio 11 support?

Tsury wrote:
Any chance of seeing IntroJucer support anytime soon?

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

Tsury
Offline
Last seen: 1 week 5 days ago
Joined: 12 May 2011 - 19:18
Re: Visual Studio 11 support?

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

abudaan
Offline
Last seen: 1 year 9 months ago
Joined: 23 Mar 2012 - 20:49
Re: Visual Studio 11 support?

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