Error when building project with sprintf

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Error when building project with sprintf

ソリューションへジャンプ
2,211件の閲覧回数
flamehaze
Contributor I

Hello,

(Sorry if my english sucks, I hope you'll understand)

So i'm in internship and i'm working on a project. So I got a problem when I build the project. Everything is fine, I don't have any errors on the code but I got this at the end : make: ***[Test_UART_v1.axf] Error 1. So I know that the problem is from the sprintf because when I delete it, everything works.

I'll just put the part with the sprintf  :

#include stdio.h

[...]

int voltage = ADC_Read(); //function created by myself

char volt_final[10];

sprintf(vol_final,"%d",voltage);

[...]

So I read some articles about the librairies and I'm new to LPCXpresso so maybe I need to do something ?

I tried itoa but it doesnt seems to work, I don't get a good result ,maybe I did something wrong with my ADC_Read().

Thank you for your help :smileyhappy:

0 件の賞賛
返信
1 解決策
1,390件の閲覧回数
lpcxpresso_supp
NXP Employee
NXP Employee

To use sprintf, you need to make sure that you are building against the "Nohost" or "Semihost" variants of the C library. For more information see:

What are none, nohost and semihost libraries? 

Switching the selected C library 

Linker error "Undefined reference to 'xxx' " 

If you need more assistance, please post full details of the error message(s) that you get in the build log:

https://community.nxp.com/message/630853 

Regards,

LPCXpresso Support

元の投稿で解決策を見る

2 返答(返信)
1,391件の閲覧回数
lpcxpresso_supp
NXP Employee
NXP Employee

To use sprintf, you need to make sure that you are building against the "Nohost" or "Semihost" variants of the C library. For more information see:

What are none, nohost and semihost libraries? 

Switching the selected C library 

Linker error "Undefined reference to 'xxx' " 

If you need more assistance, please post full details of the error message(s) that you get in the build log:

https://community.nxp.com/message/630853 

Regards,

LPCXpresso Support

1,390件の閲覧回数
flamehaze
Contributor I

Perfect, thank you very much ! The 2 articles were usefull and I understand now :smileyhappy:. 

0 件の賞賛
返信