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

compiling multiple c&h files and to make it modular

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



Joined: 21 Apr 2004
Posts: 10

View user's profile Send private message

compiling multiple c&h files and to make it modular
PostPosted: Thu May 20, 2004 11:29 pm     Reply with quote

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







PostPosted: Fri May 21, 2004 3:04 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri May 21, 2004 6:34 am     Reply with quote

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.
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