I've got a working project that I need to take parts from it without changing it's code and just write new main() for it. My directory structure:
[main_dir]/[main.cpp]
[main_dir]/[dir1]/[child1]/file1.h
[main_dir]/[dir2]/[child2]/file2.h
in main.cpp I have: include "dir1/child1/file1.h"
In file1.h I have: include "dir2/child2/file2.h"
I'm compiling: g++ main main.cpp
I'm getting "dir2/child2/file2.h" no such file or directory. I can't change file1 to do: include "../../dir2/child2/file2.h"
Somehow in the original project something in the makefile to search for all include path relative to the [main_dir] so the include from file1.h can be found.
What should I add to the makefile in order to do it as well?
g++ -o -l main main.cpp
doesn't look correct. First of all the-o
option needs the name of the output file directly after it. Secondly what is the-l
option? Is it lower-case L, or upper-case i? – Some programmer dude