S32K314 Compilation prompt "undefined reference to 'vsnprintf'"

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K314 Compilation prompt "undefined reference to 'vsnprintf'"

680 Views
Danny_Wu
Contributor I
Hello,
 
I tried to use function snprintf in my project, 
even though I had included the following H file, 
    #include <stdarg.h>
    #include <stdio.h>
    #include <string.h>
but at compile time it prompt "undefined reference to 'vsnprintf'".
Functions snprintf and sprintf are also unavailable.
 
Test environment:
S32K314,S32DS.3.5,AUTOSAR project
0 Kudos
Reply
5 Replies

649 Views
Danny_Wu
Contributor I

Thanks for your reply.

Maybe because I am using AUTOSAR project, the compilation method is different.
Do you have any advice for the AUTOSAR project on this issue?

0 Kudos
Reply

641 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Danny_Wu

This should be related to AUTOSAR,

I saw some answers, for autosar, the standard input/output functions should not be used.

The standard library functions from the '<stdio.h>' / '<cstdio>' and '<wchar.h>' header files can be

dangerous. Their behavior depends on the implementation. Besides, their use might lead to undefined

ehavior.

0 Kudos
Reply

637 Views
Danny_Wu
Contributor I
Thanks for your reply.

This means that I may not be able to use these standard library functions,
So does NXP provide functions that implement these functions (such as vsnprintf)?
0 Kudos
Reply

630 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Danny_Wu

Sorry, I didn't find any similar function for your direct reference, you need to write it yourself. And as discussed above, for AUTOSAR applications try to avoid using functions in the standard library.

0 Kudos
Reply

656 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Danny_Wu

I made a simple test, it works fine on myside.(RTD2.0.X)

Senlent_0-1690352797790.png

 

0 Kudos
Reply