I've run into this previously on an earlier project, but it was easy to patch over because there was exactly one math reference. This project is chock full of them, so I need to nip this in the bud.
Quite simply, it seems that #include <math.h> isn't doing any good, because the compiler isn't seeing any prototypes, and I'm getting a ton of messages like this:
../Sources/CalcLib/calcDenVisc.c: In function 'calcViscosity'
../Sources/CalcLib/calcDenVisc.c:81:9: warning: implicit declaration of function 'exp' [-Wimplicit-function-declaration]
../Sources/CalcLib/calcDenVisc.c: In function 'calcDensity':
../Sources/CalcLib/calcDenVisc.c:169:9: warning: implicit declaration of function 'pow' [-Wimplicit-function-declaration]
../Sources/CalcLib/calcDenVisc.c:176:9: warning: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
../Sources/CalcLib/calcDenVisc.c:200:19: warning: incompatible implicit declaration of built-in function 'pow' [enabled by default]
../Sources/CalcLib/calcFlow.c: In function 'calcFlow':
../Sources/CalcLib/calcFlow.c:59:9: warning: implicit declaration of function 'fabs' [-Wimplicit-function-declaration]
../Sources/CalcLib/calcFlow.c:155:7: warning: incompatible implicit declaration of built-in function 'fabs' [enabled by default]
../Sources/CalcLib/calcFlow.c: In function 'updateHiResTot':
../Sources/CalcLib/calcFlow.c:233:7: warning: incompatible implicit declaration of built-in function 'fabs' [enabled by default]
../Sources/CalcLib/calcSupport.c: In function 'calcHdlr_doCalcStep':
../Sources/CalcLib/calcSupport.c:249:17: warning: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
../Sources/CalcLib/calcSupport.c:258:17: warning: implicit declaration of function 'fabs' [-Wimplicit-function-declaration]
I'm running CW for MCU 10.6, with MQX v4.1.1 (had this issue with an MQX 4.0 project, too), compiling for a K20 120MHz target. This is the only system library that I seem to have issues with. Is there some special preprocessor define that I need to set in my project? (I have _EWL_C99=1 and __VFPV4__=1 defined in the preprocessor.)
David,
I've performed some tests on my side with a Hello project wizard example based on MCU v10.6 + MQX V4.1.1.
The math.h as other libraries are defined in the EWL lib.
By default the MQX project is using/including the EWL library but the options below is not selected..
- this is the cause of the warning -
In fact if you include the #include <math.h>, the function fabs() for instance will not be resolved if the EWL is not enabled.
this option will add a command line instruction when the compiler is called: -specs=ewl_c_hosted.specs (in this configuration).
Now the math.h file will be really used to solve the math functions.
This is working for my example.
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello David,
I will contact MQX colleague.
Keep you informed.
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------