using sprintf causes link to fail

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

using sprintf causes link to fail

ソリューションへジャンプ
2,158件の閲覧回数
dougm
Contributor I
char szTest[16];
sprintf(szTest,"Test\r\n");

Link Error : L1822: Symbol _STORE_FAR_16 in file C:\Program Files\Metrowerks\CodeWarrior CW12_V3.0\lib\HC12c\lib\ansib.lib is undefined
Link Error : L1822: Symbol _STORE_FAR_32 in file C:\Program Files\Metrowerks\CodeWarrior CW12_V3.0\lib\HC12c\lib\ansib.lib is undefined
Link Error : Link failed

The entire project was set up using the wizard. I tried changing from ansib.lib to ansis.lib with the same result. I also tried defining _STORE_FAR_16 using a -D_ANSI_FAR_16 as a linker arg but the linker doesn't recognize the -D_ANSI_FAR_16 and barfs with an invalid command line. What do I need to do in the project to be able to use the ansi library files like sprintf, etc.
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,069件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
Those functions are defined in datapage.c, usually this file is added by the wizard as well. So you just need to add this file to your project, it is located in lib\hc12c\src.

Also note that HC12 V4.5's sprintf does not use _STORE_FAR_16 in its default configuration (I think there is a libdefs.h option). Not sure, but can be that previous versions of sprintf did reference it.

Daniel

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,070件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
Those functions are defined in datapage.c, usually this file is added by the wizard as well. So you just need to add this file to your project, it is located in lib\hc12c\src.

Also note that HC12 V4.5's sprintf does not use _STORE_FAR_16 in its default configuration (I think there is a libdefs.h option). Not sure, but can be that previous versions of sprintf did reference it.

Daniel
0 件の賞賛
返信