g++ is compiling the files in include directory wich i don't want to

I am trying to compile a program, i have the source codes in /home/my_app/ and the library that i will use in /home/my_app/include, when i am trying to compile the program with
g++ -o my_app main.cpp windows.cpp windows.h
I am getting errors of the files who are in the include directory, is there any way to do not compile them ?
Last edited on
gcc/g++ does not compile any source code files, unless you either explicitly pass them on the command-line, as an input file, or they are #include'd in one of the specified input files. Note that #includes can be recursive!


BTW: Header files (.h or .hpp) are not intended to be compiled on their own. You generally do not pass them to the compiler explicitly as an input file! They will be #include'd by the source files that need them.
Last edited on
Topic archived. No new replies allowed.