#27555 - mr_square - Fri Oct 15, 2004 2:35 pm
Hi all - I'm having a bit of trouble with compiling my C++ code. Everthing was working fine until about 1/2 hour ago when I tried to create a new class, 'collisionDetector'. This class needs to use one of my other classes, 'playerState' , as it takes a playerState instance as an argument to one of its methods.
So I add #include "playerState.h" to the top of collisionDetector.h file, and it comes back with errors about a redefinition of the playerState class. My main.cpp file also includes the same file, but surely if its a header it should work??
Also - I was told that #include-ing C files is bad - I've compiled them into .o files like the Beginners FAQ says, but the compiler cant find their contents at compile time (they contain arrays, and the code that uses the arrays gets errors that they don't exist). I'm using:
So I add #include "playerState.h" to the top of collisionDetector.h file, and it comes back with errors about a redefinition of the playerState class. My main.cpp file also includes the same file, but surely if its a header it should work??
Also - I was told that #include-ing C files is bad - I've compiled them into .o files like the Beginners FAQ says, but the compiler cant find their contents at compile time (they contain arrays, and the code that uses the arrays gets errors that they don't exist). I'm using:
Code: |
path=C:\devkitadv\bin g++ -o city.o citybackdrop.o main.elf defines.cpp main.cpp DMA.cpp drawState.cpp background.cpp idleState.cpp bg.cpp jumpState.cpp lookUpState.cpp runLeftState.cpp trig.cpp kneelState.cpp runRightState.cpp playerState.cpp -lm objcopy -O binary main.elf main.bin |