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 compile multiple c files

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



Joined: 19 Dec 2014
Posts: 16

View user's profile Send private message

Problem compile multiple c files
PostPosted: Thu May 30, 2019 5:35 am     Reply with quote

Hi

I’m using ccs 5.008 vet.
I compile 1 c file with main function and multiple h files (I include them) and everything is great!
When I’m adding c file to the source section (even if i empty without any code) I get problem compile the project.
The error is about the production hex file.
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Thu May 30, 2019 6:41 am     Reply with quote

This is probably because CCS is a single pass compiler. You will need to put that file in your headers and #include it in your main c source file. You can look at the examples in the examples folder to see how they did that.
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Thu May 30, 2019 8:05 am     Reply with quote

Yes.

That you are referring to a 'source section', implies you are using MPLAB.
In MPLAB, _only_ the main .c file should be put into this.
Every other file (whether .c, or .h), must be put into the 'headers' section.

MPLAB 'assumes' it is using a linker, rather than a single pass compiler.
So it assumes every .c file is separately compiled.
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