views:

542

answers:

1
+1  Q: 

wxWidgets and VC++

I decided to familiarize myself with wxWidgets today. I downloaded version 2.8.9 (current release), and compiled the library in all the desired modes.

I am able to build/run the samples that ship with wxWidgets out of the box. However, when I compile with /Za (i.e., language extensions disabled), I get over 100 build errors on even the smallest wxWidgets sample.

I am unable to find any documentation on this issue. Could I define something that will switch wxWidget's internals to be standards compliant (at least as far as VC++'s compliance goes)?

Perhaps I did something wrong while building the original library... Has anyone even encountered this "issue" before?

Thanks!

EDIT: I forgot to mention that I'm using VC++ 9.

Also, here are the first few errors:

------ Build started: Project: minimal, Configuration: Unicode Debug Win32 ------

Compiling...

minimal.cpp

c:\wxWidgets-2.8.9\include\wx/dynarray.h(69) : error C2143: syntax error : missing ')' before '*'

c:\wxWidgets-2.8.9\include\wx/dynarray.h(69) : error C2143: syntax error : missing ';' before '*'

c:\wxWidgets-2.8.9\include\wx/dynarray.h(69) : error C2059: syntax error : ')'

c:\wxWidgets-2.8.9\include\wx/dynarray.h(69) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\wxWidgets-2.8.9\include\wx/dynarray.h(810) : error C2146: syntax error : missing ';' before identifier 'SCMPFUNC'

c:\wxWidgets-2.8.9\include\wx/dynarray.h(810) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\wxWidgets-2.8.9\include\wx/dynarray.h(810) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\wxWidgets-2.8.9\include\wx/dynarray.h(811) : error C2146: syntax error : missing ';' before identifier 'SCMPFUNC'

c:\wxWidgets-2.8.9\include\wx/dynarray.h(811) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\wxWidgets-2.8.9\include\wx/dynarray.h(811) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

EDIT: It looks like the first error's caused by the fact that _cdecl is used. It looks like defs.h only checks if __VISUALC__ is defined. Nothing about pedantism in sight...

+4  A: 

You'll probably find that you won't be able to build even a basic Win32 application, let alone a wxWidgets app, with /Za, because the Windows Platform SDK headers included with VS2008 use language extensions. The only solution is to disable /Za.

The specific error you're seeing is because the _cdecl keyword is a Microsoft extension, and not part of standard C++. For more information, see the documentation for /Za, and the Microsoft Extensions to C and C++ and C++ Keywords pages in MSDN.

ChrisN
Well, for what it's worth, the latest PSDK (6.1) builds with /Za without problems. As for the rest of your post, I'm well aware of how extensions work.Kind of disappointing that wxWidgets doesn't support this. Oh well, thanks for confirming!
Interesting note about the latest SDK, thanks.
ChrisN