Re: Problems in files included using relative paths.
by Ron L <ron.liechty@[EMAIL PROTECTED]
>
Oct 31, 2005 at 09:59 AM
In article <1130493190.899698.105650@[EMAIL PROTECTED]
>,
"Shrirang Khare" <shrirang.khare@[EMAIL PROTECTED]
> wrote:
>Hi,
>
>I am facing compilation problems with including header files using
>relative paths. With the same directory structure it works fine with
>gcc and cl.exe(MSVC++ compiler.)
>
>Here is the scenario :-
>I have a directory structure as follows:-
>
>System
> |
> |-----Source (contians main.c )
> |
> |-----Include (contins interface.h)
> |
> |-----Module
> |
> |-------ModuleHeaders (contians mod1.h and mod2.h )
>
>* My include path is set to the "Include" directory.
>
>* interface.h is included in main.c
>
>* interface.h contains following inclusions using relative paths
>#include "..\Module\ModuleHeaders\mod1.h"
>#include "..\Module\ModuleHeaders\mod2.h"
>
>* mod2.h contains following file inclusion
>#include "mod1.h"
>
>Compiling main.c results in an error complaining that file mod1.h
>included in mod2.h is not found.
>
>I think gcc and VC6 considers/searches the path from which the file is
>being included which in this case is Module\ModuleHeaders\ but
>Codewarrior fails to do so and gives "cannot open file" error.
>
>I wonder if this is a shortcoming in the codewarrior IDE.
>
>Regards,
>Shrirang Khare.
>
Are the search paths in the system access paths or the user access
paths, do you have always search system path for users paths selected.
You may need to make System an access path and not recursively searched.
that is how they are found in UNIX.
The standard does not specify any behavior for releative includes or
nested includes. Think about it what working directory is the relative
include start from. the compilers? the source code it is in, the path
the last header file was in? it can be anything you want. So relative
positions are just that relative.
Ron
--
CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
-- http://www.codewarrior.com/community
--
Ron Liechty - ron.liechty@[EMAIL PROTECTED]
- http://www.codewarrior.com