Help With Error Msg?
When I compile my code for a program that (agian!!) ouputs a calender, I get this error msg:
> g++ -o ./Calender ./Calender.o -s
! C:\Program Files\GNUCPP\bin\..\lib\gcc-lib\i386-mingw32\2.95.2\..\..\..\..
* \i386-mingw32\lib\libmingw32.a(main.o)(.text+0x8e): undefined reference to `
! make: *** [Calender] Error 1
---- Make had errors. Right click error line to open file.
I have attached my code. Does anyone know what this means?!
You forgot to add a main to the program.
You can compile it to object code with out a main (.o extension) but you can't create an executable.
Can u explain that in simple english, coz I'm only a beginner!!
If you mean an int/main piece of code, I do have one of those, and I include my calender.cpp at the start of it.
But, I simply can't compile this code I have here!!
I don't see a file called calander.cpp included
I only see a calender.h
>>> include my calender.cpp at the start of it.
If you mean you are using #include, with a .cpp file, then don't. For a projrct the size of yours, put all of the code in a single .cpp file.
You need to add main() to your code some where
ohhhh i think i see your problem now.
Of course you can't compile that piece of code.
When you include it in another file then the compiler should automaticly compile it.
However its best just to compile them seperatly and link them together at the end. It still should work and is the simpelist way of doing it.
For mingw this is done by either:
g++ -o FINAL_EXE_NAME Main.cpp calender.cpp
g++ -c Main.cpp
g++ -c calender.cpp
g++ --c FINAL_EXE_NAME Main.o calender.o
I can't be bothered to explain the difference between them.
So just tell me if you really want to find out.