View previous topic :: View next topic |
Author |
Message |
Carl Guest
|
including relative path + filename |
Posted: Fri Dec 01, 2006 9:41 am |
|
|
Is it possible to include files with a line like this
Code: | #include "boards/mydevice.h" |
where 'mydevice.h' is in '/folder/includes/boards' and I run ccsc like this
Code: | ccsc +FH I=/folder/includes code.c |
ccsc doesn't seem able to include files with relative
paths. As far as I can tell when we write #include "file.h" it looks in
the local folder and also in the folders specified with the
"I=path1;path2" commandline option - all good. But if we write #include
"path/file.h" it only looks in the local folder and not in the other
folders.
I'm using PCHL v3.204. Am I missing something or is this a limitation of the compiler? |
|
|
Ttelmah Guest
|
|
Posted: Fri Dec 01, 2006 9:56 am |
|
|
The syntax for the current working directory in MS OS's,is './'. So to access a local subdectory, would need:
#include "./boards/mydevice.h"
Best Wishes |
|
|
Carl Guest
|
|
Posted: Fri Dec 01, 2006 10:05 am |
|
|
Thanks for your quick reply.
I don't have a problem including from the local directory. If I write
Code: | #include "system/myos.h" |
and my local working directory contains the system subfolder it compiles fine.
What doesn't work is if the system folder is located somewhere else that I specify with the I=... option.
Regards. |
|
|
Ttelmah Guest
|
|
Posted: Fri Dec 01, 2006 10:47 am |
|
|
I wouldn't really expect it to.
The I= fomat is saying 'your include files are here'. This is seperate from the normal expansion in the C code. You'd need to experiment, but the normal C syntax, is that a file using '"', is to be found relative to the source file (not the include directory location),while one using '<' is to be found using an absolute location.
Unfortunately for what you want, the _working_ location (which is what is used internally by the location expansions), is not moved to the 'I=' directory.
Best Wishes |
|
|
Carl Guest
|
|
Posted: Mon Dec 04, 2006 8:27 am |
|
|
I've used the PCHW (windows) compiler with wine and it works fine with the same project. It's version 3.211. So I assume the problem with the include paths either only exists in the Linux compiler, or was corrected/improved between PCHL v3.204 and PCHW v3.211 (I don't know if the version numbers of PCHW and PCHL match). |
|
|
|