Page 1 of 1

[SOLVED] Broken Header Include Location

Posted: Wed Sep 28, 2016 6:52 am
by Octacone
Language: C
Compiler: i386 GCC Cross Compiler
Operating System: Linux Ubuntu Latest

I have a big problem. I can't include header files using #include "../Folder/Something/FileIwantToInclude.h"
I am constantly getting:

Code: Select all

fatal error: ../Headers/Kernel/FileIwantToInclude.h: No such file or directory
I am loosing my mind. This used to work...
Also this is my folder tree type:

Code: Select all

Basic OS
  ˇHeaders
    ˇ Kernel
        ˘ FileIwantToInclude.h
Does anybody know what is going on?

Re: Broken Header Include Location

Posted: Wed Sep 28, 2016 7:01 am
by Octocontrabass
Where is the file you're putting the #include directive in?

Re: Broken Header Include Location

Posted: Wed Sep 28, 2016 7:08 am
by Octacone
Octocontrabass wrote:Where is the file you're putting the #include directive in?
Oh... #-o :idea:
It is in a different directory... I can't use that since they are not starting from the same root point.

I figured this out: $OS -> exported path to my OS root folder.
Now how do I do this:

Code: Select all

#include "$OS/Headers/Kernel/Types.h"

Re: Broken Header Include Location

Posted: Wed Sep 28, 2016 7:17 am
by Octocontrabass
You didn't answer my question. :roll:

To add to GCC's list of directories to search for headers, use "-iquote path" or "-I path". Paths added with "-iquote" will only be searched if you include with quotation marks, not angle brackets. (They're not really angle brackets.)

Re: Broken Header Include Location

Posted: Wed Sep 28, 2016 7:20 am
by Mikumiku747
It might be wise to look into the -I option of GCC, especially you'll have to change every single include statement if you decide to change the structure again.

Perhaps something like:

Code: Select all

i686-elf-gcc ... -I$OS/Headers ...
Would be good.

Never mind, Octocontrabass already made that suggestion

Re: Broken Header Include Location

Posted: Wed Sep 28, 2016 7:34 am
by Octocontrabass
Octocontrabass wrote:Where is the file you're putting the #include directive in?
Octocontrabass wrote:You didn't answer my question. :roll:
:roll:

Re: Broken Header Include Location

Posted: Wed Sep 28, 2016 7:34 am
by Octacone
Mikumiku747 wrote:
It might be wise to look into the -I option of GCC, especially you'll have to change every single include statement if you decide to change the structure again.

Perhaps something like:

Code: Select all

i686-elf-gcc ... -I$OS/Headers ...
Would be good.

Never mind, Octocontrabass already made that suggestion
Thanks Octocontrabass and Mikumiku747 for helping me out. It works! =D>

[SOLVED] Broken Header Include Location

Posted: Wed Sep 28, 2016 7:36 am
by Octacone
Octocontrabass wrote:
Octocontrabass wrote:Where is the file you're putting the #include directive in?
Octocontrabass wrote:You didn't answer my question. :roll:
:roll:
It is in:
Sources/Kernel/Kernel.c

Re: [SOLVED] Broken Header Include Location

Posted: Wed Sep 28, 2016 11:40 am
by Octocontrabass
octacone wrote:Sources/Kernel/Kernel.c
Wouldn't the correct include path be "../../Headers/Kernel/FileIwantToInclude.h"?

[SOLVED] Broken Header Include Location

Posted: Thu Sep 29, 2016 12:35 pm
by Octacone
Octocontrabass wrote:
octacone wrote:Sources/Kernel/Kernel.c
Wouldn't the correct include path be "../../Headers/Kernel/FileIwantToInclude.h"?
Oh you can do two of these: ../
Didn't know that :/
Thanks for helping!!