View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 11, 2004 11:29 am |
|
|
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
|
|
Posted: Fri Mar 12, 2004 1:56 am |
|
|
Thx PCM programmer
That works fine
Andreas |
|
|
alemeno
Joined: 22 Sep 2011 Posts: 1 Location: Miami, Florida
|
|
Posted: Fri Oct 07, 2011 11:37 am |
|
|
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: 1615 Location: Central Illinois, USA
|
|
Posted: Fri Oct 07, 2011 11:43 am |
|
|
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 |
|
|
|