New pc compiling error regarding <template>?


#1

From time to time I pull the new git, and update mac and pc versions of some juce based software. This time I’m having trouble compiling the pc version. The only changes that I noticed which affected this code since the last compilation were regarding addLineSegment(Line(x,y,x,y,), thickness); … which previously was addLineSegment(x,y,x,y,thick). The errors are template related, so this makes sense … but beyond that I’m rather lost.

I should note that I am using VS2005 (and, by the way, I tried compiling the juce_demo and couldn’t figure out where some needed files were… like juceLibraryCode/juceHeader.h … is that still in the repo somewhere? Maybe I’m just not seeing it).

compiling errors:
1>C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(894) : error C2988: unrecognizable template declaration/definition
1>C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(894) : error C2059: syntax error : '('
1>C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(894) : error C2090: function returns array
1>C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(894) : error C2988: unrecognizable template declaration/definition
1>C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(894) : error C2059: syntax error : ')'
1>C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(1454) : error C2143: syntax error : missing ‘;’ before '*'
1>C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(2938) : error C2143: syntax error : missing ‘;’ before 'identifier’
1>C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(2938) : warning C4091: 'typedef ’ : ignored on left of ‘_FLOATING_SAVE_AREA’ when no variable is declared
1>C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(2938) : fatal error C1075: end of file found before the left brace ‘{’ at ‘C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(22)’ was matched

The relevant portion of winnt.h … line 894 … is:

extern “C++” // templates cannot be declared to have ‘C’ linkage
template <typename T, size_t N>
char (*RtlpNumberOf( UNALIGNED T (&)[N] ))[N];

#define RTL_NUMBER_OF_V2(A) (sizeof(*RtlpNumberOf(A)))


#2

That’s what you’d expect to see if you include windows.h after juce.h, because juce defines the T macro. Just include windows.h before juce.h and you’ll be fine. It’s always worked like that, though, I don’t know why you’d suddenly hit this.


#3

Aha! I actually saw that on a different post but didn’t put it all together.

Lot’s of changes lately … so I’ll have to dig to find how it happened, but this should help me get through it fast enough.

Thanks as always.