I have a main code (.cpp
) and some other files (.cpp
and their corresponding .h
file) which contain the function that are used in my main program. I'd like to know how to compile my files and run the main code.
This depends on your compiler. For example, with GCC you might write:
g++ foo.cpp bar.cpp baz.cpp -o foo # compile program
./foo # run program