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

How to use additional "'c" files with 1 header

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



Joined: 06 Aug 2016
Posts: 107
Location: Moscow

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

How to use additional "'c" files with 1 header
PostPosted: Fri Apr 05, 2019 11:45 pm     Reply with quote

Hi to everyone! Long time no see.

I tried, but I get "device required before this line" in the header file.

Compiler version 5.81
Windows 7 Pro.
_________________
Yo! I love learning and technology! I just do not have experience so do not be angry if I ask a stupid question about a detail! From so much to remember sometimes I forget the details in order to remember the big problems!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: How to use additional "'c" files with 1 header
PostPosted: Sat Apr 06, 2019 1:17 am     Reply with quote

Arakel wrote:

I tried, but I get "device required before this line" in the header file.

Don't add additional C files to the "Source Files" section of the MPLAB X
project window. Only your main C file should be in that section.
If you add more files that way, you will get the "Device required" error.
To add more C source files, just #include them in your main C file.

Example: I want to add flex_lcd.c to my project. So I just add an
#include line for it in my main C file, as shown below. I also want
a ds1307 driver and an eeprom driver, so I #include them too.
See below:
Code:
#include <18F46K22.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOPBADEN
#use delay(clock=4M)
#use rs232(baud=9600, UART1, ERRORS)

#include "flex_lcd.c"
#include "ds1307.c"
#include "24256.c"

//==========================
void main()
{
lcd_init();
   
while(TRUE);
}   
Arakel



Joined: 06 Aug 2016
Posts: 107
Location: Moscow

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

PostPosted: Sat Apr 06, 2019 7:30 am     Reply with quote

Its working. I tried it on CCS directly. I don't use MPLAB because its very heavy.

No header file and don't add the source file in the files list on the left and its ok.

Thank you very much for the help!
_________________
Yo! I love learning and technology! I just do not have experience so do not be angry if I ask a stupid question about a detail! From so much to remember sometimes I forget the details in order to remember the big problems!
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