Problems with noexcept


#1

Well, I just upgraded to the Juce 2.0 release and I am getting errors on top of errors… It doesn’t happen with just my project but with building the Introjucer too. Here are a few lines that I am getting errors on. There are over 3,000 of them so I don’t want to blow up the post with them. The are almost all identical anywyas with the ‘noexcept’ problem. I did switch to VS2011 beta too so this could be a problem with that too. I will start here before I go to their forums since it is only the building of Juce projects that are having problems. Am I doing something wrong or is there something that different that I need to do with VS2011?

1>c:\users\randi\documents\visual studio 11\juce\modules\juce_core\memory\juce_memory.h(37): error C3646: ‘noexcept’ : unknown override specifier
1>c:\users\randi\documents\visual studio 11\juce\modules\juce_core\memory\juce_memory.h(41): error C3646: ‘noexcept’ : unknown override specifier
1>c:\users\randi\documents\visual studio 11\juce\modules\juce_core\memory\juce_memory.h(56): error C3646: ‘noexcept’ : unknown override specifier
1>c:\users\randi\documents\visual studio 11\juce\modules\juce_core\memory\juce_memory.h(62): error C3646: ‘noexcept’ : unknown override specifier


#2

Just found this post. http://rawmaterialsoftware.com/viewtopic.php?f=3&t=8734&hilit=noexcept So, you may ignore this. It doesn’t really assist with the problem but lets me know that there is an issue when using VS2011 with Juce.


#3

+1

I trying to compile code that compiled under VS2005/JUCE2.0, but I am getting errors from lines using ‘noexcept’. Compiling after importing old projects results in a ton of “error C3646: ‘noexcept’ : unknown override specifier” errors, from what looks to be the same files (juce_Memory.h, juce_MathsFunctions.h, juce_CharacterFunctions.h, juce_Atomic.h, and juce_CharPointer_UTF8.h, at which point the compile fails due to error count exceeding 100).

According to this MS note (http://msdn.microsoft.com/en-us/library/wfa0edys(v=vs.110).aspx): “In C++0x, the noexcept operator is introduced, but support for this feature is not yet present in Visual C++ as of Visual Studio 2012.” So, we shouldn’t use it yet, BUT, juce_PlatformDefs.h sets JUCE_COMPILER_SUPPORTS_NOEXCEPT to 1, based on newer compiler version (1700). Seems easy enough to take that out, but then code from xkeycheck.h (an MS file) generates errors, because it believes ‘noexcept’ is a keyword.

In my attempt to hack something together (as I am working towards a proof of concept), I haven’t come to a final solution, but I did develop a work around. Just prior to the first error (in juce_Memory.h) I ‘#undef noexcept’, and then ‘#define noexcept throw()’. So far so good, but would love an official fix.


#4

throw-spec, noexcept, throw(), are all junk anyway.


#5

I’ve not installed VS2011 yet (and was hoping to avoid doing so…).

So if setting JUCE_COMPILER_SUPPORTS_NOEXCEPT to 0 causes problems, which include statement is pulling in that xkeycheck.h file?


#6

It’s included by ‘yvals.h’, which is included by all kinds of other MS headers… this is obviously a bug in VS, ie. noexcept is NOT part of VS yet, but they won’t let us #define it so that we can have cross platform code. Hopefully it will be fixed when the final release is out.


#7

Ok, well I guess in the meantime I’ll just leave JUCE_COMPILER_SUPPORTS_NOEXCEPT set to 0.

But it’s odd… Surely other people have been using VS2011? Why has nobody else had this problem?


#8

I have wondered why no one else is reporting any problems, and I am hoping I am just doing something stupid, which the chance of is increased by the fact that I am importing my projects, and VS may have done some ‘backwards compat’ thing inside the project files. otoh, this problem is trivial compared to the issue I was seeing trying to port our code to JUCE2.0, which I am hoping the compiler upgrade fixes. That issue was that I have a class that derives from Slider, and when I initialized my member variables, they were overwriting the pimpl pointer in the Slider base class. A couple of days spinning my wheels on that one, and we decided to see if it was a compiler bug…


#9

That doesn’t sound like a compiler bug to me. More likely you’ve got more than one version of juce_slider.h, and are including the wrong one somewhere.


#10

Sadly, it did not turn out to be a compiler bug, which would have made fixing it easy. Lol. Now I need to figure out why different pieces of code see the structure of this class differently (different versions of header, different structure packing, etc). All of which I thought I had checked for. The good news, for me, is that this code worked with the 1.4x codebase, so somehow thru the importing of my vs2005 projects, some settings (include paths, build options, etc) have caused this problem to appear. The other (probably a red hering) thing is that the slider class changed to using the pimpl, and we had made some modifications to allow access to some private members. But I just added some accessor functions to thee new slider class. Any methods of chasing this down would be appreciated. For example, I’ve used Process Monitor, from SysInternals, to verify that I am only including one copy of the juce_Slider header.


#11

Yeah. same issues here.

I just downloaded VS2012. For what it’s worth, now it’s free (the whole thing apparently, not just a crappy express version) and it seems to be a better program overall than vs2008 was (not saying much there though, still not as nice as xcode in most ways).

I set JUCE_COMPILER_SUPPORTS_NOEXCEPT to 0, but there seems to be plenty of other syntax bits that are not supported anymore (problems with undefined EMIT, errno_t, noreturn all pop up right away).

Using VS2012 with the 2010 toolset seems to work out ok at least.

ok - back to the salt mines.


#12

Gah… I’ve not tried it VS2012 yet, I guess I probably should do…


#13

on the other hand … they are still calling the download a beta … so they might still tweak the toolset. In which case you might end up making changes you wouldn’t need to if you wait. Dunno.

The vs program is getting better though, that’s nice.


#14

So it seems that VS2012 only runs in Windows 8… So I downloaded the Windows 8 beta, but it won’t run in my Parallels VM for more than a few minutes without blue-screening. I’ll have to give up for now!


#15

You’re lucky. I never see a blue screen on W8, because it always hard-freeze on the “locking” screen.
I’ve no idea why, but I really hope it’ll be fixed in the upcoming versions.


#16

Jules, I am running VS2012 on W7.


#17

Oh, ok…! When I looked at their website it seemed to say Win8 only, so I never thought to try that. Thanks, I’ll have a go.


#18

FYI I’ve got it compiling under VC2012 now.

Annoying that even though they still haven’t implemented noexcept (which must surely be pretty easy to do…?), they have added some code to stop us from simulating it with a macro.


#19

Hi Jules. I’ve just hit this problem, but don’t want to update Juce since I’m in the middle of a release. How did you fix the issue? I’m thinking of doing something like:

#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_CXX2011) #define juce_noexcept throw() // for c++98 compilers, we can fake these newer language features. #define juce_nullptr (0) #else #define juce_noexcept noexcept #define juce_nullptr nullptr #endif

And then doing a massive search and replace.


#20

oh, ok, ignore.

I just checked the tip, and there is an easier way:

#if defined (_MSC_VER) && _MSC_VER > 1600 #define _ALLOW_KEYWORD_MACROS 1 // (to stop VC2012 complaining) #endif