compiling multiple c&h files and to make it modular
Posted: Thu May 20, 2004 11:29 pm
I'm working on a big C file and I plan to chop it to multiple c files and h files. I placed the defines at the h file and all the callable functions to separate c files (to make it modular). I made also one c file that contained only the includes for c and h files plus the main file with statements calling some functions from the modular c files but I receive errors like:
Deleting intermediary files... done.
Executing: "C:\Program Files\PICC\Ccsc.exe" "MYLCD.c" +FM +DF +LN +T -A +M +Z +Y=9 +EA
*** Error 70 "C:\CCS_LCD_TEST\MYLCD.c" Line 138(0,1): No MAIN() function found
Halting build on first failure as requested.
BUILD FAILED: Thu May 06 13:04:45 2004
Is it ok to compile a c file when it is used as modular(meaning c file that contains function only and include file(h) that can be called by any separate main file)?
jaremek16 Guest
Posted: Fri May 21, 2004 3:04 am
I'm not sure what do you want to do but you can't compiling only procedures without main program.
You should compile main program which has included modules *.c or *.h
Do so :
Executing: "C:\Program Files\PICC\Ccsc.exe" "MYPRG.c"
where MYPRG consists of:
Code:
#include <ctype.h>
#include <MYLCD.c>
main() {
while(TRUE) {
put_char_lcd(); // this procedure is described in MYLCD
}
}
best regards
Charlie U
Joined: 09 Sep 2003 Posts: 183 Location: Somewhere under water in the Great Lakes
Posted: Fri May 21, 2004 6:34 am
It looks like you are using the MPLAB IDE. You should only include the file that has your main() function call in the project. Delete all include files from the MPLAB project. They will be automatically included by the CCS C compiler as each #include is encountered during the compile process.
I usually have my #include xxx.h files in the beginning of my mainprog.c file, then my core program with main(), then at the end #include xxx.c.
Then in MPLAB, just add the mainprog.c program and compile.
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