Hello,
I have a very large project that consists of numerous libraries and a ThreadX RTOS application. In one of the libraries, I have a C++ class that handles mutexes and I can compile that library without issues. However, when I compile the code application, I get an error "undefined reference to `_txe_mutex_info_get'".
I have double checked the includes, the include paths, the libraries, the library paths, but everything seems correct. (Commenting out the "tx_mutex_info_get()" function call kills the error.) To make it more frustrating, both the library and the application code have been playing nice for over a year and the function call "tx_mutex_info_get()" is used in other functions in the same class without errors. I've walked all of the changes I've made since the last compile, but that too has proven unfruitful.
Does anyone have any suggestions?
UINT RtController_Mutexes::_getMutexOwner(
TX_MUTEX * mutex,
TX_THREAD ** owner)
{
UINT status;
std::string msg;
CHAR ** name = NULL;
ULONG * count = NULL;
TX_THREAD ** first_suspended = NULL;
ULONG * suspend_count = NULL;
TX_MUTEX ** next_mutex = NULL;
status = tx_mutex_info_get(
mutex,
name,
count,
owner,
first_suspended,
suspend_count,
next_mutex);
// Check for log file controller creation error.
if( status != TX_SUCCESS)
{
// Error stuff
} else
return( status);
}
解決済! 解決策の投稿を見る。
'undefined reference' means that you are calling that method/function/object, but the linker cannot find it.
A few things to check:
- is txe_mutex_info_get called with C or C++ name mangling? It could be that it has been compiled with C++, but you are calling it with C naming? (note: extern "C")
- use the IDE image info: is that object in question present in the binary or not?
- provide a dummy/empty txe_mutex_info_get() in your application, just to make the linker happy. Then check the map file what happend with the one from the OS
- are you using higher level of optimizations? I have seen cases with some 'not so clean code' where the compiler/linker have removed objects, which had lead to such errors
I hope this helps,
Erich
'undefined reference' means that you are calling that method/function/object, but the linker cannot find it.
A few things to check:
- is txe_mutex_info_get called with C or C++ name mangling? It could be that it has been compiled with C++, but you are calling it with C naming? (note: extern "C")
- use the IDE image info: is that object in question present in the binary or not?
- provide a dummy/empty txe_mutex_info_get() in your application, just to make the linker happy. Then check the map file what happend with the one from the OS
- are you using higher level of optimizations? I have seen cases with some 'not so clean code' where the compiler/linker have removed objects, which had lead to such errors
I hope this helps,
Erich
Thanks Erich! I was able to determine that the functions were in the library, but the functions were indeed mangled. I ended up revamping the includes and added "extern "C"" to the "#include" statements and I'm moving forward again. Thanks!