CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

including relative path + filename

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Carl
Guest







including relative path + filename
PostPosted: Fri Dec 01, 2006 9:41 am     Reply with quote

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







PostPosted: Fri Dec 01, 2006 9:56 am     Reply with quote

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







PostPosted: Fri Dec 01, 2006 10:05 am     Reply with quote

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







PostPosted: Fri Dec 01, 2006 10:47 am     Reply with quote

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







PostPosted: Mon Dec 04, 2006 8:27 am     Reply with quote

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).
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group