S32K314 Compilation prompt "undefined reference to 'vsnprintf'"

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K314 Compilation prompt "undefined reference to 'vsnprintf'"

2,121 次查看
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 项奖励
回复
5 回复数

2,090 次查看
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 项奖励
回复

2,082 次查看
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 项奖励
回复

2,078 次查看
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 项奖励
回复

2,071 次查看
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 项奖励
回复

2,097 次查看
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 项奖励
回复