User forums > Help
Problems with including header files.
Brain Damage:
the problem is that that program isn't written by me, i just wanted to add few changes then compile it, the strange thing is that it compiles on other compilers like .NET C++ using <> for the includes, i guess i'll have to manually include the project's folder inside the include paths becasue i'm not gonna edit 200+ files to replace the includes syntax :x
thanks for the help
stahta01:
Things to Try
Note: in theory option 2 should only be done for <> includes but, I have found it helps to compile code that I wish to not have to edit for "" includes also.
Note: I have yet to get the project to link so it might be a bad decision.
Note: On doing option 1; I would suggest coping the compiler setting and modify the copy; then setting your project to use the modified copy.
1. Change the "Global Compiler Settings" for the Compiler you are using by "Other" Tab
Checking "Explicitely add currently compiling file directory ..."
OR/AND
Checking "Explicitely add project top level directory ..."
2. "Project" -> "Build Options" set values "Compiler", "Linker" or "Resource Compiler" under "directories" tab
Tim S
Brain Damage:
the program is nested this way:
main folder/
---Subfolder1/
-------A.cpp
-------A.h
---Subfolder2/
-------B.cpp
-------B.h
now A.cpp contains:
#include <Subfolder1/A.h>
#include <Subfolder1/A.h>
the compiler stops when it checks #include <Subfolder1/A.h> but not with only #include <Subfolder1/A.h>
i know to be totally correct it should be #include <A.h> or #include "A.h", but that syntax works for other IDE, it's just code::blocks that doesn't accept it, i've tried even different compilers with code::blocks but it always does the same error. With other IDEs, it's acceptied.
the option #1 works if i use the syntax #include "A.h" or the syntax #include <A.h>; but not if i use #include <Subfolder1/A.h>, now all the include references are made that way; changing them would be too tedious.
the option #2 works with all syntax, i've included the source's folder inside the include paths and it compiles it.
my problem is: i have few projects with that structure; do have i to add to every single project to the include paths, or is there a variable or a relative reference that i can set in the global compiler settings to avoid to do that for every project?
stahta01:
main folder/
---project.cbp
---Subfolder1/
-------A.cpp
-------A.h
---Subfolder2/
-------B.cpp
-------B.h
now A.cpp contains:
#include <Subfolder1/A.h>
#include <Subfolder1/A.h>
I have been up for 48 hours straight so I might not make alot of sence.
I would put your project.cbp file in the folder "main folder". And then try to use option 1 of
Change the "Global Compiler Settings" for the Compiler you are using by "Other" Tab
Checking "Explicitely add project top level directory ..."
Then the
#include <Subfolder1/A.h>
#include <Subfolder1/A.h>
Should work if I understand everything.
Tim S
Brain Damage:
Thank you very much, now works perfectly.
Navigation
[0] Message Index
[*] Previous page
Go to full version