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

problem with a kind of a loop #include

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 11, 2004 11:29 am     Reply with quote

I'm not sure what you're doing, but I think you're trying to
be too fancy for CCS. There is no linker in CCS, so there
is no "extern". All files have to be "added" to the project
with #include statements. Here is one way to do a project
with several source modules in CCS:

Code:
#include <18F458.H>
#fuses XT, NOPROTECT, NOBROWNOUT, NOWDT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, errors)
#use i2c(Master, SDA=PIN_C4, SCL=PIN_C3)
#zero_ram
#ignore_warnings 202, 203
//----------------------------

// Header files for your modules.
#include <ds1307.h>         
#include <24LC256.h>

// Other source modules.
#include <ds1307.c>
#include <24LC256.c>

//----------------------------
// Function prototypes for functions in this module.

void power_up_init(void);

//=======================================
void main()
{
power_up_init();   

init_eeprom();

// Put other code here.

while(1);
}

//===========================
void power_up_init(void)
{
setup_adc_ports(NO_ANALOGS);
output_low(PIN_A0);
output_high(PIN_A1);
// etc.

}
Skywalker



Joined: 11 Mar 2004
Posts: 5
Location: Germany/Ilmenau

View user's profile Send private message ICQ Number

PostPosted: Fri Mar 12, 2004 1:56 am     Reply with quote

Thx PCM programmer

That works fine

Andreas Very Happy
alemeno



Joined: 22 Sep 2011
Posts: 1
Location: Miami, Florida

View user's profile Send private message

PostPosted: Fri Oct 07, 2011 11:37 am     Reply with quote

I'm trying to add a .c file to my project using the #include but the compiler tells me "File can not be opened", and no file is added to my project. I even created a new project with the code above from PCM programmer and got the same results. What am I not doing right? Me compiler version is 4.104
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Fri Oct 07, 2011 11:43 am     Reply with quote

Are you using

#include "filename.c"

or

#include <filename.c>

they are different.

While the "" looks in the same directory as the 'C' file you're compiling, <> will look in the library paths (whatever they may be)

if you have a subdirectory of .C files in your project directory, then you should include that subdir like thus:

#include "somedir/somefile.c"

I've also had global routines included in sub-projects like this

#include "../globalroutines.c"


-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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