Page 1 of 1

Specifying include path in DJGPP

Posted: Thu Dec 27, 2001 12:00 am
by Guest
This is a real stupid question I bet, but I just can't figure out how to specify
where to look for #included files via the command line. I've tried the -I- and -I
flags but nothing seems to work. Can someone please give me an example? Let's say
my include path is 'C:\Dev\Include' and all of my sources are in 'C:\Dev'. How
would I do this? Much thanks in advance.

RE:Specifying include path in DJGPP

Posted: Thu Dec 27, 2001 12:00 am
by j.weeks
>On 2001-12-27 14:14:51, Anonymous wrote:
>This is a real stupid question I bet, but I just can't figure out how to specify
>where to look for #included files via the command line. I've tried the -I- and -I
>flags but nothing seems to work. Can someone please give me an example? Let's say
>my include path is 'C:\Dev\Include' and all of my sources are in 'C:\Dev'. How
>would I do this? Much thanks in advance.

You're on the right track.
You've got two options:

-- Option 1 -------------------
in your source:
#include "include/file.h"

-- Option 2 -------------------
on the command line:
gcc file.c -Iinclude

and in your source:
#include <file.h>

-------------------------------
You should note that djgpp is a port of a unix
compiler, and so it probably only accepts forward
slashes for include files. Don't try something
like -I\dev\include, it should be -I/dev/include

Also, as you probably know includes with "" assume
that the include is in the current directory, unless
other explicitly states, and includes with <> assume
to be in the standard include dirs, unless
explicitly states with -I's

Jeff

RE:Specifying include path in DJGPP

Posted: Fri Dec 28, 2001 12:00 am
by Guest
Well, I tried both of your options, yet neither worked for me. Maybe I
should give you a better understanding of my setup.

The actual drive I'm working off of is G:. The sources are separated into
different subdirectories under 'G:\Dev'. For instance, there's 'G:\Dev\Kernel',
'G:\Dev\Video', etc. My include directory is 'G:\Dev\Include'.

In the source file, I tried using something like
'#include "/dev/include/myinclude.h"' and '#include "G:/dev/include/myinclude.h"'.
I've also tried the same but in the '#include <myfile>' format. None of these worked.

I've also tried numerous variations via command line. Nothing seems to
work! Is there anything else I should try?

RE:Specifying include path in DJGPP

Posted: Fri Dec 28, 2001 12:00 am
by j.weeks
>I've also tried numerous variations via command line. Nothing seems to
>work! Is there anything else I should try?

That's weird man. Have you tried just a
include "../include/file.h" ?

That's the way I usually do it.

Jeff

RE:Specifying include path in DJGPP

Posted: Sat Dec 29, 2001 12:00 am
by Guest
>That's weird man. Have you tried just a
>include "../include/file.h" ?

Thanks man. I tried that one and it worked. Thanks a lot!