I am fairly new to C++ programming and very new to programming using the Maya C++ API. I have been trying to use the GNU C++ compiler because I have the 64-bit version of Maya, but I only have the free to use 32-bit version of Visual C++. This is all running in 64-bit Windows Vista.
The problem is when I try to compile the helloWorldCmd.cpp example which comes with Maya I get errors saying there are problems with the Maya header files that are included. Are there actually problems with Maya’s compiler headers, or is it just that GNU C++ cannot be used for compiling plugins for Maya? I need help because this issue may stop me dead on going further with learning how to write plug-ins for Maya.
Below are the generated compiler errors. If anyone can decipher what the issue might be I would be most grateful:
C:\MyPrograms>c++ helloWorldCmd.cpp -o helloWorld.exe
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../include/
maya/MString.h:47:0, from c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../include/
maya/MSimple.h:48, from helloWorldCmd.cpp:30:
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../include/maya/MTypes.h:239:8: e
rror: expected identifier before 'false'
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../include/maya/MTypes.h:239:8: e
rror: expected '}' before 'false'
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../include/maya/MTypes.h:239:8: e
rror: expected unqualified-id before 'false'
c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../include/maya/MTypes.h:239:18:
error: expected declaration before '}' token
The problem with using a full version of Visual Studio is that for a learner the cost of buying it is a bit prohibitive and a native install of Visual C++ Express only compiles to 32-bit targets. However, I came across this blog post which explained how to get Software Development Kit to use with Visual C++ Express which does compile to 64-bit. It also explains how to do all further setup ready to build Maya plugins:
http://prilisa.com/2012/01/my-first-maya-2011-c-plug-in.html