PDA

View Full Version : Linker error when i link C code



navi1084
22nd November 2008, 08:20
Hi,
I have generated a library file which is written in C code. When i try to link in my QT main application its giving following
error error LNK2019: unresolved external symbol "unsigned short __cdecl function..........."


How can i resolve this????

caduel
22nd November 2008, 09:31
two possibilites:
* you do not really link against that library: (-l switch in gcc)
* your header does not declare the functions as "C" functions and thus they were name mangled as C++ functions and thus are not found in the lib
(though I guess that the __cdecl indicates that the error is rather the first one)

HTH

navi1084
22nd November 2008, 09:48
yes absolutely. I used extern "C" while including the C header file. working fine.


Thank you