Link Error

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

Link Error

跳至解决方案
3,279 次查看
blakehodder
Contributor III

Please help.

 

When compiling debug it works fine. Once I compile the project for release I get the following link error:

 

Link Error     : Undefined : "_io_sdcard_install"

 

Link failed

 

Any ideas why this would compile for debug and receive that error once compiling for release?

 

Thanks in advance.

标签 (1)
标记 (3)
0 项奖励
回复
1 解答
3,067 次查看
JimDon
Senior Contributor III

Any chance in the debug build you are linking to a lib, but in release you are not?

在原帖中查看解决方案

0 项奖励
回复
12 回复数
3,067 次查看
JimDon
Senior Contributor III

Since I don't have the project, I can only guess.

In release the optimizer is on, perhaps that function gets optimized away????

0 项奖励
回复
3,067 次查看
blakehodder
Contributor III

Thanks Jim,

Is there a way to tell if it gets optimized away?

0 项奖励
回复
3,067 次查看
JimDon
Senior Contributor III

Look in the map file.

What is in the function?

0 项奖励
回复
3,067 次查看
JimDon
Senior Contributor III

I really meant do you have the function body?

0 项奖励
回复
3,067 次查看
blakehodder
Contributor III

Sorry, I believe this is what you were asking for:

if(_io_sdcard_install("sdcard:",(pointer)&tSYS_system_sd_init,tSYS_system_spi_handle)==MQX_OK)

it appears to say that the entire _io_sdcard struct is undefined.

Thanks

0 项奖励
回复
3,067 次查看
JimDon
Senior Contributor III

I think it's saying that the function _io_sdcard_install is not defined.

Do you know where _io_sdcard_install is defined?

0 项奖励
回复
3,067 次查看
blakehodder
Contributor III

It is defined in sdcard.h:

extern _mqx_int _io_sdcard_install(char_ptr,SDCARD_INIT_STRUCT_PTR,MQX_FILE_PTR);

Out of curriousity, it should be defined if it will compile for debug would it not?

Thanks

0 项奖励
回复
3,067 次查看
blakehodder
Contributor III

Here is the entire Errors:

Link Error   : Undefined : "_io_sdcard_install"

Referenced from "SYS_system_fs_setup" in

Error   : Undefined : "_io_sdcard_spi_init"

Referenced from "tSYS_system_sd_init" in

Error   : Undefined : "_io_sdcard_spi_read_block"

Referenced from "tSYS_system_sd_init" in

Error   : Undefined : "_io_sdcard_spi_write_block"

Referenced from "tSYS_system_sd_init" in

Link failed.

0 项奖励
回复
3,068 次查看
JimDon
Senior Contributor III

Any chance in the debug build you are linking to a lib, but in release you are not?

0 项奖励
回复
3,067 次查看
blakehodder
Contributor III

It was indeed not linking to the library. I recompiled the MQX libraries for release and it compiled no problem.

Thanks

0 项奖励
回复
3,067 次查看
blakehodder
Contributor III

Quite possibly,I just dug a little deeper and realized that when I compiled the MQX libraries I compiled the debug but no the release. Trying that right now.

Thanks

0 项奖励
回复
3,067 次查看
blakehodder
Contributor III

SYS_system.c is what is calling it. it is declared in sdcard.h

0 项奖励
回复