how to specify relative path include directories and/or files [message #222016] |
Fri, 15 August 2008 00:42  |
Eclipse User |
|
|
|
I am trying to build a program called "ig" (in "/home/max/workspace/ig")
that contains .h and .cpp files that contain many #include statements that
look like the following couple lines:
#include "../ice/math.h"
#include "../ice/mathasm.h"
Intuitively, I would expect the above would tell the environment
everything it needs to know --- it needs to process the included files at
the indicated relative path in the filesystem. But that doesn't work. At
one point I fumbled my way into setting a "resource" of some kind that
specified the "/home/max/workspace/ice" directory, and it did compile a
few times. But now it no longer compiles, with error messages that
indicate it is not finding the symbols/functions in those files, even
though that resource still exists in the project properties. I'm not sure
what this means, but I sorta half remember seeing an eclipse checkbox that
said something about the permissions on that directory, and I may have
disabled write access on that directory (to be safe). Maybe that's when
it stopped working - but I cannot make any dialog box appear now with any
permissions in it. But I have recreated the directory and replaced the
files in it, and the permissions are "drwxr-xr-x".
What is the "correct" way to individual files in another directory like
this (or include the entire directory full of files, if that option
exists)?
Thanks.
|
|
|
Re: how to specify relative path include directories and/or files [message #222058 is a reply to message #222016] |
Fri, 15 August 2008 17:48   |
Eclipse User |
|
|
|
Normally you specify the location of your directories on the compiler
command line.
For instance, I have a program foo.c that includes the math.h file.
foo.c
#include "math.h"
gcc -c -I /home/max/workspace/ice foo.c
The -I option tells gcc to search that directory for include files.
Ray
max reason wrote:
> I am trying to build a program called "ig" (in "/home/max/workspace/ig")
> that contains .h and .cpp files that contain many #include statements
> that look like the following couple lines:
>
> #include "../ice/math.h"
> #include "../ice/mathasm.h"
>
> Intuitively, I would expect the above would tell the environment
> everything it needs to know --- it needs to process the included files
> at the indicated relative path in the filesystem. But that doesn't
> work. At one point I fumbled my way into setting a "resource" of some
> kind that specified the "/home/max/workspace/ice" directory, and it did
> compile a few times. But now it no longer compiles, with error messages
> that indicate it is not finding the symbols/functions in those files,
> even though that resource still exists in the project properties. I'm
> not sure what this means, but I sorta half remember seeing an eclipse
> checkbox that said something about the permissions on that directory,
> and I may have disabled write access on that directory (to be safe).
> Maybe that's when it stopped working - but I cannot make any dialog box
> appear now with any permissions in it. But I have recreated the
> directory and replaced the files in it, and the permissions are
> "drwxr-xr-x".
>
> What is the "correct" way to individual files in another directory like
> this (or include the entire directory full of files, if that option
> exists)?
>
> Thanks.
>
|
|
|
Re: how to specify relative path include directories and/or files [message #222083 is a reply to message #222058] |
Sat, 16 August 2008 20:16  |
Eclipse User |
|
|
|
Project->Properties->
C/C++ Build->Settings->
Tool Settings <Tab>->GCC C++ Compiler->Directories->
Include paths (-I)
contains "/home/max/workspace/ice".
Project->Properties->
C/C++ Build->Settings->
Tool Settings Tab->GCC C++ Compiler
displays (on the right side of the window):
command: g++
options: -DCPU32 -DLINUX -I/home/max/workspace/ice -O0 -g3 -Wall -c
-traditional-cpp -fmessage-length=0
Is that equivalent to what you suggest?
QUESTION: This code was running several months ago on fedora8 with an
older version of eclipse. Now I am trying to continue development with a
new computer with ubuntu linux and new (ganymede) eclipse IDE/CDT. The
project "import" process more-or-less worked, except for the inclusion of
the "../ice" directory. The files in the "../ice" directory are useful to
include in many projects, which is why they are in a separate directory.
And I am still updating those routines, so I don't want to make a [shared]
library yet (I want to edit/debug/develop those functions while I develop
other applications that call those functions).
In the previous setup (fedora8/eclipse), the "../ice" directory appeared
inside the main "ig" project directory in the "Project Explorer". So
obviously I had configured the "../ice" directory to be part of this
application in some different sense - because now the ice directory is
listed inside a ~folder~ immediately under the "ig" project called
"Includes" (which also contains all the standard library includes like
"/usr/include/c++" and so forth).
Can anyone clearly explain how to tell eclipse to make [the files in]
other directories (not subdirectories) fully part of the current project?
I (and others) will much appreciate that (especially if it explains the
distinctions between the different but similar ways of achieving similar
results).
Ray Hurst wrote:
> Normally you specify the location of your directories on the compiler
> command line.
> For instance, I have a program foo.c that includes the math.h file.
> foo.c
> #include "math.h"
> gcc -c -I /home/max/workspace/ice foo.c
> The -I option tells gcc to search that directory for include files.
> Ray
> max reason wrote:
>> I am trying to build a program called "ig" (in "/home/max/workspace/ig")
>> that contains .h and .cpp files that contain many #include statements
>> that look like the following couple lines:
>>
>> #include "../ice/math.h"
>> #include "../ice/mathasm.h"
>>
>> Intuitively, I would expect the above would tell the environment
>> everything it needs to know --- it needs to process the included files
>> at the indicated relative path in the filesystem. But that doesn't
>> work. At one point I fumbled my way into setting a "resource" of some
>> kind that specified the "/home/max/workspace/ice" directory, and it did
>> compile a few times. But now it no longer compiles, with error messages
>> that indicate it is not finding the symbols/functions in those files,
>> even though that resource still exists in the project properties. I'm
>> not sure what this means, but I sorta half remember seeing an eclipse
>> checkbox that said something about the permissions on that directory,
>> and I may have disabled write access on that directory (to be safe).
>> Maybe that's when it stopped working - but I cannot make any dialog box
>> appear now with any permissions in it. But I have recreated the
>> directory and replaced the files in it, and the permissions are
>> "drwxr-xr-x".
>>
>> What is the "correct" way to individual files in another directory like
>> this (or include the entire directory full of files, if that option
>> exists)?
>>
>> Thanks.
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03500 seconds