|
|
View previous topic :: View next topic |
Author |
Message |
moutinho
Joined: 12 May 2005 Posts: 31 Location: BRAZIL
|
Strange!!! Does CCS project can?t have multiple .C files??? |
Posted: Thu May 12, 2005 12:22 pm |
|
|
Hi,
I am trying to build a simple project composed by the following files:
Source Files
file01.c
main.c
Header Files
18F6720.h
def_hw.h
file01.h
file01.c:
*******************
// file1.c
#include "file01.h"
int sum(int a, int b)
{
return a + b;
}
*******************
main.c:
*******************
// main.c
#include "file01.h"
main()
{
int c = sum(1,1);
}
*******************
file01.h
*******************
//file01.h
#include "def_hw.h"
int sum(int, int);
*******************
I am having the following compiler error:
*** Error 70 "D:\Desenvolvimento Delfos\fonte\18F\Teste02\file01.c" Line 9(0,1): No MAIN() function found
If I place everything in only ONE .c file it works!!
Question: Can?t I have multiple .c files in one CSS project???????
Thanks in advance,
Andre Moutinho |
|
|
sseidman
Joined: 14 Mar 2005 Posts: 159
|
Re: Strange!!! Does CSS project canīt have multiple .C files |
Posted: Thu May 12, 2005 12:37 pm |
|
|
moutinho wrote: |
If I place everything in only ONE .c file it works!!
Question: Canīt I have multiple .c files in one CSS project???????
|
Only by #INCLUDE-ing additional c files.
Scott |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Thu May 12, 2005 2:45 pm |
|
|
CCS Cross Compiler doesnīt use a linker like TC Borland and others compilers does.
You can debug files individually, then must be listed as included files at the end of main.
The whole files format should follow this aproach:
Code: |
//__________________________________
Header
//__________________________________
#include <18F6720.h>
#include <def_hw.h>
#include <file01.h>
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,errors)
//__________________________________
Defines Declarations
//__________________________________
#define Buffer_Size 16
#define TRUE 1
#define Red_LED LATB.5
//__________________________________
Global Variables Declarations
//__________________________________
int8 a, b, c;
int16 d;
float e;
char x;
int8 Buffer_ZX[Buffer_Size];
//__________________________________
Function Prepositions
//__________________________________
long sum(int a, int b);
float mul(int a, int b);
//__________________________________
Function Definitions
//__________________________________
long sum(int a, int b)
{
return (a + b);
}
//__________________________________
M A I N
//__________________________________
main()
{
a = 4;
b = 8;
d = sum(a,b);
e = mul(a,b);
}
//__________________________________
Included Files
//__________________________________
#include <file1.c>
#include <file2.c>
#include <file3.c>
//__________________________________
|
file1.c Code: |
float mul(int a, int b)
{
return (a * b);
}
|
Best wishes,
Humberto
NOTE: This is my own opinion/style, not a general rule. |
|
|
|
|
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
|