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

sscanf compile problem

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



Joined: 14 Dec 2009
Posts: 33
Location: Wales

View user's profile Send private message

sscanf compile problem
PostPosted: Wed Jan 27, 2010 11:23 am     Reply with quote

I've tried to compile this code below with the test program and first version of sscanf, but get the error in the the header file :-

*** Error 23 "C:\SSCANF\18F4620.h" Line 2(8,9): Can not change device type this far into the code

The original posting is below:
http://www.ccsinfo.com/forum/viewtopic.php?t=20225&highlight=sscanf

The error is related to this line in the header file for PIC4620
#device PIC18F4620 <- Error is with this statement
#nolist

Compiler is Version 4.088, anyone know what the problem is ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 27, 2010 12:28 pm     Reply with quote

Quote:

#include <18F4620.h>
#device *=16

#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=10000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) // Jumpers: 8 to 11, 7 to 12

Just edit the Test program and change the #include line for the PIC
to 18F4620.h and that should do it. Also, the #device *=16 is not
needed with 18F PICs. You can delete that line.
ac34856



Joined: 14 Dec 2009
Posts: 33
Location: Wales

View user's profile Send private message

PostPosted: Thu Jan 28, 2010 6:31 am     Reply with quote

No that wasnt it - a long list of errors still related to the header file.
Reinstalled compiler V4.088

*** Error 7 "D:\SSCANF\18F4620.h" Line 188(2,6): Invalid Pre-Processor directive
*** Error 48 "D:\SSCANF\18F4620.h" Line 188(18,23): Expecting a (
*** Error 43 "D:\SSCANF\18F4620.h" Line 188(0,1): Expecting a declaration
*** Error 7 "D:\SSCANF\18F4620.h" Line 219(2,6): Invalid Pre-Processor directive
*** Error 48 "D:\SSCANF\18F4620.h" Line 219(18,23): Expecting a (
*** Error 43 "D:\SSCANF\18F4620.h" Line 219(0,1): Expecting a declaration
*** Error 18 "D:\SSCANF\test.c" Line 7(10,19): File can not be opened
Not in local "D:\SSCANF\input.c"
*** Error 18 "D:\SSCANF\sscanf.c" Line 28(10,20): File can not be opened
Not in local "D:\SSCANF\string.h"
*** Error 18 "D:\SSCANF\sscanf.c" Line 29(10,20): File can not be opened
Not in local "D:\SSCANF\stdlib.h"
*** Error 12 "D:\SSCANF\sscanf.c" Line 86(30,36): Undefined identifier strtod
*** Error 12 "D:\SSCANF\sscanf.c" Line 103(46,52): Undefined identifier strtol
*** Error 51 "D:\SSCANF\sscanf.c" Line 104(9,13): A numeric expression must appear here
*** Error 12 "D:\SSCANF\sscanf.c" Line 122(33,40): Undefined identifier strtoul
*** Error 51 "D:\SSCANF\sscanf.c" Line 123(9,13): A numeric expression must appear here
*** Error 12 "D:\SSCANF\sscanf.c" Line 141(16,23): Undefined identifier isspace
*** Error 51 "D:\SSCANF\sscanf.c" Line 146(11,15): A numeric expression must appear here
*** Error 12 "D:\SSCANF\sscanf.c" Line 164(33,40): Undefined identifier strtoul
*** Error 51 "D:\SSCANF\sscanf.c" Line 165(9,13): A numeric expression must appear here
*** Error 12 "D:\SSCANF\test.c" Line 37(18,22): Undefined identifier NULL
*** Error 12 "D:\SSCANF\test.c" Line 40(5,15): Undefined identifier get_string
*** Error 12 "D:\SSCANF\test.c" Line 61(18,22): Undefined identifier NULL
*** Error 12 "D:\SSCANF\test.c" Line 66(7,17): Undefined identifier get_string
*** Error 12 "D:\SSCANF\test.c" Line 91(18,22): Undefined identifier NULL
*** Error 12 "D:\SSCANF\test.c" Line 96(7,17): Undefined identifier get_string
*** Error 12 "D:\SSCANF\test.c" Line 121(18,22): Undefined identifier NULL
*** Error 12 "D:\SSCANF\test.c" Line 126(7,17): Undefined identifier get_string
*** Error 12 "D:\SSCANF\test.c" Line 151(18,22): Undefined identifier NULL
*** Error 12 "D:\SSCANF\test.c" Line 156(7,17): Undefined identifier get_string
*** Error 12 "D:\SSCANF\test.c" Line 181(18,22): Undefined identifier NULL
*** Error 12 "D:\SSCANF\test.c" Line 186(7,17): Undefined identifier get_string
*** Error 12 "D:\SSCANF\test.c" Line 211(18,22): Undefined identifier NULL
*** Error 12 "D:\SSCANF\test.c" Line 216(7,17): Undefined identifier get_string
*** Error 12 "D:\SSCANF\test.c" Line 241(18,22): Undefined identifier NULL
*** Error 12 "D:\SSCANF\test.c" Line 246(7,17): Undefined identifier get_string
*** Error 12 "D:\SSCANF\test.c" Line 271(18,22): Undefined identifier NULL
*** Error 12 "D:\SSCANF\test.c" Line 276(7,17): Undefined identifier get_string
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 28, 2010 1:09 pm     Reply with quote

I don't have vs. 4.088. I have 4.087 and 4.089 and it compiled with
no errors with those versions.

Look at line 188 in 18F4620.h (or a few lines before) and see if you
notice anything wrong.
ac34856



Joined: 14 Dec 2009
Posts: 33
Location: Wales

View user's profile Send private message

PostPosted: Thu Jan 28, 2010 1:19 pm     Reply with quote

Damned annoying but I managed to compile it in the end.
Might be some issue with MPLab

Thanks for your reply though.
Ttelmah
Guest







PostPosted: Fri Jan 29, 2010 4:14 am     Reply with quote

I'd suspect the problem is the old 'favourite', of including the files in the project.
Basically, in MPLAB, you must _not_ include the 'include' files, in the main project. If you do, MPLAB, tries to compile each of these separately, which doesn't work, since many depend on values being set by their 'host' file. Only the actual 'core' source file should be in the project itself, then the compiler loads the other include files as needed.

Best Wishes
ac34856



Joined: 14 Dec 2009
Posts: 33
Location: Wales

View user's profile Send private message

PostPosted: Fri Jan 29, 2010 11:48 am     Reply with quote

Yes that was part of the problem .... very annoying.
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