I find this question strange because CodeBlocks uses G++.
When you compile with the command line g++
, you need to specify all the source files that need compiling and linking:
g++ -o main main.cpp file1.cpp file2.cpp
You will also need to include the libraries with the -l
option. The libraries depend on your OS and platform.