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

multiple file compile issue

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







multiple file compile issue
PostPosted: Fri Nov 20, 2009 12:13 pm     Reply with quote

Hi,
I have a file that I have used for many years. I wanted to add some new functions, some define statements and variable declarations. I added this new file as a source in my MPLAB project. The compiler errors on '#device statement required in the new file'. When I add a device statement the compiler then states that I can't change the device this far into the code. The device statement is the same
#device = PIC18F4685.
Any suggestions?
Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 20, 2009 12:44 pm     Reply with quote

See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=37125
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 20, 2009 1:14 pm     Reply with quote

Don't use a separate line with a #device = PIC18F4685 statement.
That statement already exists in the .H file for your PIC. Just include
the 18F4685.H file with an #include statement at the top of your main
source file.

Add all additional modules (C source files) to your main program with
#include statements. Don't add them to the "Source Files" list in MPLAB.
The "Source Files" list should only have your main source file.
For convenience, you can add additional source files to the "Other Files"
list in MPLAB. This is just so you can easily click on them and view them.
hawker
Guest







PostPosted: Fri Nov 20, 2009 7:44 pm     Reply with quote

Thanks, that fixed it. Does this imply that any .c file in the "other" file category is compiled with the main source? I have no reference to my second file in the main source file.
Thanks again
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 20, 2009 8:00 pm     Reply with quote

Remove it from the "Other Files" list and see what happens. Experiment.
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