@bartuasian
Yes, try linking them with the compiler, clang++ or gnu++, whichever one you have (I have both). You may also want to set various flags:
You don't compile header files separately; you #include them in the driver and implementation, and your compiler should automatically compile them into the executable with the others.
Are you using c++ or g++ for compiling, or are you using an IDE? I would try using g++ or c++ in the command line, and use this format:
c++ -std=c++2a -g -o executable program implementation |
or
g++ -std=c++2a -g -o executable program implementation |
The
-g flag is for debugging, you can leave that out if you don't need to debug. The
-o flag sets the name of the executable; if you leave it out, it defaults to
a.out.
executable is whatever you want to call your exec,
program is the name of your driver program, like "rectangleProgram.cpp", and
implementation is the name of your class implementation file, like "rectangle.cpp.
Or:
g++ -std=c++2a -Wall -Wextra -pedantic program.cpp implementation.cpp |
-Wall This enables all warnings; I always use it because that way I don't get unexpected results when I run my programs.
-Wextra Enables extra warnings.
-pedantic Honestly, I am not entirely sure what that does...I will look into it and when I find something, I'll post back.
The driver comes first, then the executable. At least that's how my g++ manual says to do it. If it works the way you do it, then you can ignore what I said.