|
|
View previous topic :: View next topic |
Author |
Message |
jthand
Joined: 04 Sep 2016 Posts: 1
|
Problems with Math.h |
Posted: Sun Sep 04, 2016 2:48 pm |
|
|
Has anyone ever had trouble with the Math.h file? After including the file in the code and compile it, I get more than 100 errors. Is there a newer version or corrected copy floating around? |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sun Sep 04, 2016 2:57 pm |
|
|
Probably an error earlier on, show us your code from the beginning up to the point you include the math.h file. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Mon Sep 05, 2016 12:53 am |
|
|
Just a guess. You'd get exactly this if you are using MPLAB, and 'include' the file in the list of files to compile.
This is not how you do it in MPLAB. In MPLAB, the only file that should be in the 'source files' tab, is your main code. The include files go in the 'other files' tab. If you put math.h in the source files tab, the compiler will try to compile it. It _won't_ compile on it's own. It requires the header information from your code.
Sequence in CCS needs to be:
Your 'main' code file.
This has at the top, the line to include the processor define file.
Then #device statements.
Then #fuses
The clock statement
#pin select statements
Then #use statements (RS232, PWM, I2C etc.)
Then include 'libraries' like math.h
Then your actual code.
These can all be in separate include files if required, provided this is the basic order in which they are met.
In MPLAB, you then tell the IDE, that this main file is the one to compile (and the only one to compile).
If you run a compile, you will then find that all the included files, automatically get put in the 'other files' tab.
Now you can 'play' with the orders a little, but not much, so if you do anything much before any #device lines, you will get complaints. If you use timings before the clock statement, this will give incorrect results. If you try to use getc and putc before the #use statements, again incorrect results. #pin select statements have to be before #use statements involving the pins, or again complaints. |
|
|
|
|
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
|