Linking a lib with QT on linux
-
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
-
undefined reference to `fwConsole_initConsoleHeader(FW_CONSOLE_HEADER*)'
-
Since it's a C library you must make sure that the compiler also interpret your header as C ->
extern "C" { #include "fw_console_api.h" }
Or fix the header so it's not needed for every include of it.
-
Thank you so much, that fixed it
-
Since it's a C library you must make sure that the compiler also interpret your header as C ->
extern "C" { #include "fw_console_api.h" }
Or fix the header so it's not needed for every include of it.
@Christian-Ehrlicher
Hi
You are so fast. :)
What did you run on it too see it was a C lib ?
or just be looking in the .h file ? -
@mrjj said in Linking a lib with QT on linux:
What did you run on it too see it was a C lib ?
I got a linker error, looked at the exports and they looked like plain C exports. Then the idea with the wrong symbols was there :)
-
@mrjj said in Linking a lib with QT on linux:
What did you run on it too see it was a C lib ?
I got a linker error, looked at the exports and they looked like plain C exports. Then the idea with the wrong symbols was there :)
@Christian-Ehrlicher
Ok, where did you look at the exports ?
With objdump or ?
Im asking as i want to learn. Since you knew so fast and i was still looking at it :) -
@mrjj said in Linking a lib with QT on linux:
With objdump or ?
Yes, "objdump -T" - take a look at the libfw_console_api.so output and you will notice that they're plain C functions - they are not annotated.
-
@mrjj said in Linking a lib with QT on linux:
With objdump or ?
Yes, "objdump -T" - take a look at the libfw_console_api.so output and you will notice that they're plain C functions - they are not annotated.
@Christian-Ehrlicher
Thank you
Its handy to know. goes on my of list of things to try when you get undefined's and
checked path many times :=) -
for the header fix, I added in the header and that took care of it
#ifdef __cplusplus #define FWCONSOLEAPI_DECLSPEC extern "C" #else #define FWCONSOLEAPI_DECLSPEC extern #endif//__cplusplus
thank you again, you guys are awesome