I’ve had this problem for a while and been just throwing my headers into my (ROOT)/include directory as the solution - this works but is very messy.
NOTE: this is ONLY my headers - okapi, display, etc all compile fine.
I’m not very experienced in cpp and very inexperienced with larger projects.I looked at the Makefile and it looked like they were set up to include everything in subdirectories of include. The line that stood out to me was
TEMPLATE_FILES=(INCDIR)/**/*.h (INCDIR)/**/*.hpp
This looks to me like it should include every header with .h or .hpp in any subdirectory of include?
The error seems to be raised in common.mk which to me means nothing but might be helpful. I tried looking through common.mk but I don’t understand any of it. If it helps - I have not changed anything in Makefile or common.mk since creating the project.
I also tried explicitly adding “$(ROOT)/include/subsys” and failed (granted I may have (and probably did) do this wrong).
The directories look the same as on creation of the project with the exception of a subsys directory in include and src which each hold my .hpp and .cpp files.
Any help would be greatly appreciated.
This worked, thanks.
I knew this was an option but when I tried I don’t think I gave syntastic enough time to update so they were still highlighted and I undid the change assuming it didn’t work.
This doesn’t answer the question of why the Makefile doesn’t cover it but I can look into that more in my own time.
One of them is bound to work. Also you might have to add a space like
-I $(ROOT)/include/myIncludesDir
but maybe not. I haven’t tested it, you will probably have to tinker with it a little to get it working how you want.
After that is properly done, you should be able to include the file you want without a relative path:
#include "myHeader.hpp"
See the comment above TEMPLATE_FILES, it looks like that is meant for people creating PROS libraries:
# files that get distributed to every user (beyond your source archive) - add
# whatever files you want here. This line is configured to add all header files
# that are in the the include directory get exported
TEMPLATE_FILES=$(INCDIR)/**/*.h $(INCDIR)/**/*.hpp
Also, users are not really intended to edit common.mk I think it might get overwritten by PROS updates.
as you can see, any directory specified in INCDIR and EXTRA_INCDIR are passed to the compiler with -iquote. INCDIR is defined in the default Makefile on line 13 so if you want to make the things in include/subsys generally accessible to the rest of your project without having to specify the relative path, you can either place it there directly or else define EXTRA_INCDIR. (an example of the latter is the PROS kernel)
hope this helps, and sorry for misunderstanding your original post