User forums > Using Code::Blocks
compiles fine in command prompt, but code blocks complains
killerbot:
ok it fails for me too. Normal: you didn't add the printStuff.cpp and .h to the project !!!
darkwalk:
<you didn't add the printStuff.cpp and .h to the project !!!>
I think I did:
http://peter-shih.com/images/sd.JPG
closed/open CodeBlocks again. Same thing. Is there a command or something to make code blocks print an inheritance list?
Biplab:
In the project file, you've provided, you didn't add the printstuff.h/printstuff.cpp files. I added them and it compiled fine. See the log.
--- Quote ----------------- Build: Debug in asdf2 ---------------
mingw32-g++.exe -Wall -fexceptions -g -IC:\MinGW\include -c C:\Temp\asdf2\printStuff.cpp -o obj\Debug\printStuff.o
mingw32-g++.exe -LC:\MinGW\lib -o bin\Debug\asdf2.exe obj\Debug\printStuff.o obj\Debug\main.o
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
--- End quote ---
darkwalk:
<add the printstuff.h/printstuff.cpp files>
Okay, I'm giong to sound like a noob here. I know I have to add the files in the project so that CodeBlocks can generate the necessary makefile. I think I've done so
http://peter-shih.com/images/sd.JPG
Looking at the screen shot, the "printStuff.cpp" and "printStuff.h" files are listed under the sources and headers project tree. Is this not sufficient ot include them in the project? If so, what else do I need to do?
darkwalk:
Looking at the log:
-------------- Build: Debug in asdf2 ---------------
Linking console executable: bin\Debug\asdf2.exe
obj\Debug\main.o: In function `main':
C:/Documents and Settings/x/Desktop/asdf2/main.cpp:5: undefined reference to `print_hello()'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
This verifies that "printStuff.cpp" is not compiled before the linking. How do I include "printStuff.cpp" in the compilation?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version