Link Error

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

Link Error

Jump to solution
1,030 Views
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.

Labels (1)
0 Kudos
1 Solution
818 Views
JimDon
Senior Contributor III

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

View solution in original post

0 Kudos
12 Replies
818 Views
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 Kudos
818 Views
blakehodder
Contributor III

Thanks Jim,

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

0 Kudos
818 Views
JimDon
Senior Contributor III

Look in the map file.

What is in the function?

0 Kudos
818 Views
JimDon
Senior Contributor III

I really meant do you have the function body?

0 Kudos
818 Views
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 Kudos
818 Views
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 Kudos
818 Views
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 Kudos
818 Views
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 Kudos
819 Views
JimDon
Senior Contributor III

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

0 Kudos
818 Views
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 Kudos
818 Views
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 Kudos
818 Views
blakehodder
Contributor III

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

0 Kudos