View previous topic :: View next topic |
Author |
Message |
NivNavick
Joined: 01 Nov 2010 Posts: 47
|
include <math.h> twice |
Posted: Sat Mar 05, 2011 3:21 am |
|
|
Hi ,
I included math.h file in two of my .c files and it gives me an error
Quote: | Function definition different from previous definition y != float |
when I delete one of the two includes it's works perfectly but when there is more than one in my program it's writing the above error
what should I do in order to fix it?
Thanks
(CCS COMPILER V 4.114 ) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Mar 05, 2011 3:12 pm |
|
|
Delete all of them except one:
Include math.h in your main source file, and put it above any other
#include statements for other source files. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Sat Mar 05, 2011 4:05 pm |
|
|
If you look at the file, it shouldn't matter if you load it twice. The file tests right at the start for 'math_h' being defined, and if it is, the rest of the file doesn't load. If not, it defines this, and loads.
A number of possibilities exist:
1) The file has been modified.
2) A second file with the same name is present.
3) A very old version.
4) Something else is modifying the math_h define.
etc...
Best Wishes |
|
|
|