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

v4.064 include math.h error <solved>

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



Joined: 01 Jul 2010
Posts: 9155
Location: Greensville,Ontario

View user's profile Send private message

v4.064 include math.h error <solved>
PostPosted: Thu Jan 13, 2011 2:01 pm     Reply with quote

Ok, thought I'd try the math.h functions instead of shoveling snow..
compiler version 4.064
math.h is revised 2007
pic PIC16F88

Program, 16f88.h and math.h all in same folder.

Bare bones code( flash led). works 100%.
NOTHING fancy...

if I add the line..
Code:
#include <math.h>

and compile I get 100+ errors,
first one is

*** Error 48 "C:\PCMupdates\picc4064\PICC\Projects\MATH.H" Line 36(9,16): Expecting a (

which seems to point to the first math function...

comment out as follows
//#include <math.h>

Recompile and all is well.

I figure I'm doing something wrong but shouldn't it compile fine, even if I do not call a function from math.h?


Last edited by temtronic on Thu Jan 13, 2011 8:47 pm; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 13, 2011 2:08 pm     Reply with quote

I compiled the test program shown below with vs. 4.064 and go no errors.
Code:

CCS PCM C Compiler, Version 4.064, xxxxx     13-Jan-11 12:06

               Filename: pcm_test.lst

               ROM used: 18 words (0%)
                         Largest free fragment is 2048
               RAM used: 6 (2%) at main() level
                         6 (2%) worst case
               Stack:    0 locations


Code:
Executing: "C:\Program Files\PICC\Ccsc.exe" +FM "pcm_test.c" +DF +LY  -T -A +M -Z +Y=9 +EA -EW #__16F88=TRUE
      Memory usage:   ROM=0%      RAM=2% - 2%
      0 Errors,  0 Warnings.
Loaded C:\Program Files\PICC\Projects\PCM_Test\pcm_test.cof.
BUILD SUCCEEDED: Thu Jan 13 12:06:52 2011


Code:
#include <16F88.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)

#include <math.h>

//======================================
void main(void)
{

while(1);
}
temtronic



Joined: 01 Jul 2010
Posts: 9155
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 13, 2011 2:44 pm     Reply with quote

Hay PCM, appreciate the fast reply!

Ok, I cut and pasted your program into a new project, even changed the compile options to yours...thinking one of mine(defaults) wasn't right but...

..still won't compile...

unless I comment out the include as before
//#include <math.h>

I can open all the files and they appear ok... just copies from the original folders.

Sure is a head scratcher.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 13, 2011 2:48 pm     Reply with quote

Quote:
just copies from the original folders

But that is a difference. I'm compiling this code from the original
installation files. The compiler is installed in this directory structure:
Quote:
c:\program files\picc
c:\program files\picc\drivers
c:\program files\picc\examples
etc.

My project file is in the same overall directory structure:
Quote:
c:\program files\picc\projects\pcm_test\pcm_test.c

I don't have the CCS files copied to any other place. Are you possibly
mixing files from different versions of the compiler ? That should not
be done.

I suggest you re-install the compiler and build the program from the
original files.
temtronic



Joined: 01 Jul 2010
Posts: 9155
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 13, 2011 8:53 pm     Reply with quote

Ok, reinstalled, but still same issue....

took a lonnnnng break.

finally tried putting copies of all the files ( .h headers,.inc includes and main.c ) into same folder

compiles fine.....

I would have thought the compiler would have grabbed the picxxx.h from the devices folder, the math.h from the examples folder and the myprogram.c from my projects folder...

oh well....

guess tomorrow I'll see how much ROM log(x) takes up....

... all for a simple thermisitor DTC project to whittle away the winter !

Thanks PCM for the feedback !
Ttelmah



Joined: 11 Mar 2010
Posts: 19315

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 3:40 am     Reply with quote

It does....
It looks in the current directory, and _then_ in the defined directories for the includes etc..
Somewhere your defines in this regard are wrong.
The options are retained from old installs, so if (for instance), you installed once into 'PICC', and then latter into 'PICCNEW', the defines will only be right for one of them, and will need changing if you want to use the other.
If you have the IDE, 'Options', 'Project Options', 'Include Files'.
This can be both useful, and a caveat. Useful, if you want to (say) compiler using 4.099, but with the include files from 4.115. A caveat, if you are using multiple versions, and lose track of which includes you are actually using.....

Best Wishes
temtronic



Joined: 01 Jul 2010
Posts: 9155
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jan 14, 2011 7:19 am     Reply with quote

Well it just got more interesting ! During the compile, I actually got to read the compiler title screen info(takes a few seconds for the math.h stuff..) and it says I'm using V4.025 ! Not the 4.064 I thought I was using....
Looks like I'm going to have to do some major 'house cleaning' on this XP machine as I 'thought' I was smart having versions in their own folders...projects in their own folders,etc.
I'll try a superclean install with defaults and try to start over.
First,brew another pot of java...
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