OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:35 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: [SOLVED] Broken Header Include Location
PostPosted: Wed Sep 28, 2016 6:52 am 
Offline
Member
Member
User avatar

Joined: Fri Aug 07, 2015 6:13 am
Posts: 1134
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:
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:
Basic OS
  ˇHeaders
    ˇ Kernel
        ˘ FileIwantToInclude.h


Does anybody know what is going on?

_________________
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader


Last edited by Octacone on Wed Sep 28, 2016 7:35 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Broken Header Include Location
PostPosted: Wed Sep 28, 2016 7:01 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
Where is the file you're putting the #include directive in?


Top
 Profile  
 
 Post subject: Re: Broken Header Include Location
PostPosted: Wed Sep 28, 2016 7:08 am 
Offline
Member
Member
User avatar

Joined: Fri Aug 07, 2015 6:13 am
Posts: 1134
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:
#include "$OS/Headers/Kernel/Types.h"

_________________
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader


Top
 Profile  
 
 Post subject: Re: Broken Header Include Location
PostPosted: Wed Sep 28, 2016 7:17 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.)


Top
 Profile  
 
 Post subject: Re: Broken Header Include Location
PostPosted: Wed Sep 28, 2016 7:20 am 
Offline
Member
Member
User avatar

Joined: Thu Apr 16, 2015 7:37 am
Posts: 64
Quote:
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:
i686-elf-gcc ... -I$OS/Headers ...

Would be good.



Never mind, Octocontrabass already made that suggestion


Top
 Profile  
 
 Post subject: Re: Broken Header Include Location
PostPosted: Wed Sep 28, 2016 7:34 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
Octocontrabass wrote:
Where is the file you're putting the #include directive in?
Octocontrabass wrote:
You didn't answer my question. :roll:

:roll:


Top
 Profile  
 
 Post subject: Re: Broken Header Include Location
PostPosted: Wed Sep 28, 2016 7:34 am 
Offline
Member
Member
User avatar

Joined: Fri Aug 07, 2015 6:13 am
Posts: 1134
Mikumiku747 wrote:
Quote:
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:
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>

_________________
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader


Top
 Profile  
 
 Post subject: [SOLVED] Broken Header Include Location
PostPosted: Wed Sep 28, 2016 7:36 am 
Offline
Member
Member
User avatar

Joined: Fri Aug 07, 2015 6:13 am
Posts: 1134
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

_________________
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader


Top
 Profile  
 
 Post subject: Re: [SOLVED] Broken Header Include Location
PostPosted: Wed Sep 28, 2016 11:40 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
octacone wrote:
Sources/Kernel/Kernel.c

Wouldn't the correct include path be "../../Headers/Kernel/FileIwantToInclude.h"?


Top
 Profile  
 
 Post subject: [SOLVED] Broken Header Include Location
PostPosted: Thu Sep 29, 2016 12:35 pm 
Offline
Member
Member
User avatar

Joined: Fri Aug 07, 2015 6:13 am
Posts: 1134
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!!

_________________
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot] and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group