Hi:
My project has below error info when use fabs() function:
S32DS/e200_ewl2/EWL_C/src/math/fabsf.c undefined reference to `__fabs' Demo line 22 C/C++ Problem
Platform : S32 Design Studio for Power Architecture Version: 2017.R1 MPC5748G
The fabsf.c:
#include <ansi_parms.h>
#include <ewl_misra_types.h>
#if _EWL_FLOATING_POINT && _EWL_USES_SUN_SP_MATH_LIB
#include <math.h>
#ifdef __USING_INTRINSIC_FABS__
#define __HAS_FABS 1
extern double fabs(double x)
{
return __fabs(x) ;
}
So I need to include some head files?
I look forward to receiving a response., thanks !
Solved! Go to Solution.
Hi,
Do you want to use only EWL library? You can use newlib library instead:
1. Delete #define fabs(x) implementation from your Main_Z4b.c file
2. Add libm library in linker settings and delete "${VLE_EWL_DIR}\lib\e200z4\fp" from Library search path
3. Select newlib in Target Processor settings
I hope it will help. :smileyhappy:
PS: If you still want to use EWL:
1. Delete Release and Debug folders from your project.
2. Delete #define fabs(x) implementation from your Main_Z4b.c file.
3. Uncheck the following settings:
4. You are welcome.
Best regards,
Dmitry
Hi,
i tried hello world project - and only what I need to add is #include <math.h>
Also make sure that hardware floating point is enabled in project properties:
Hi Jiri:
Thanks for your reply.
I find 'fabs()' can be work in new project, but my project is new by older version S32DS.
Some head file not similar to new project. The attachment is my demo project.
I would appreciate it if you could use my project (file Main_Z4b.c line 21).
PS: I can't rebuild a new project on the new version.
Best regards.
Hi,
Do you want to use only EWL library? You can use newlib library instead:
1. Delete #define fabs(x) implementation from your Main_Z4b.c file
2. Add libm library in linker settings and delete "${VLE_EWL_DIR}\lib\e200z4\fp" from Library search path
3. Select newlib in Target Processor settings
I hope it will help. :smileyhappy:
PS: If you still want to use EWL:
1. Delete Release and Debug folders from your project.
2. Delete #define fabs(x) implementation from your Main_Z4b.c file.
3. Uncheck the following settings:
4. You are welcome.
Best regards,
Dmitry
hello, I am having the same problem for S32K148 on S32DS.
How to solve this ld error:undefned reference to 'ciel'?
Which library to add and what Target processor settings to do?
Hi Dmitry:
I use new library and 'fabs()' work now ^_^.
Thanks very much.
Best regards.
Include this content in your fabsf.c file and build
#define __fabs \ ({ \ double __value, __arg = (x); \ asm volatile ("fabs %0,%1" : "=f" (__value): "f" (__arg)); \ __value; \ })
Regards,
VinothS
Hi VinothS:
Thanks for your reply.
I have do as you say and change some base platform.
#define fabs(x) \
({ \
double __value, __arg = (x); \
__asm__ volatile ("fabs %0,%1" : "=f" (__value): "f" (__arg)); \
__value; \
})
But the compiler report another error.
impossible constraint in 'asm'
Upload a demo project , it's delete part of the code.
I would appreciate it if you could use my project (file Main_Z4b.c line 21).
Best regards.