PDA

View Full Version : using a staticlib



divide
5th December 2012, 10:06
Hi,

My global project build a static lib with the following .pro file:


TARGET = kissfft
TEMPLATE = lib
CONFIG += staticlib

[...]

DESTDIR = bin

and an application using the static lib with the following .pro file:


LIBS += -Lkissfft/bin -lkissfft
INCLUDEPATH += kissfft
DEPENDPATH += kissfft/bin
PRE_TARGETDEPS += kissfft/bin

I'm using Qt Creator 2.6.0 / Qt5b2 with MSVC2010 compiler.

As soon as I try to build my project, I get the following link errors:


buffer.obj:-1: erreur : LNK2019: unresolved external symbol "void __cdecl kiss_fftr(struct kiss_fftr_state *,float const *,struct kiss_fft_cpx *)" (?kiss_fftr@@YAXPAUkiss_fftr_state@@PBMPAUkiss_fft _cpx@@@Z) referenced in function "public: virtual void __thiscall threadR2C::run(void)" (?run@threadR2C@@UAEXXZ)

texbuffer.obj:-1: erreur : LNK2001: unresolved external symbol "void __cdecl kiss_fftr(struct kiss_fftr_state *,float const *,struct kiss_fft_cpx *)" (?kiss_fftr@@YAXPAUkiss_fftr_state@@PBMPAUkiss_fft _cpx@@@Z)

Sounds strange since I'm using the same compiler in both case (lib and app). Any idea ?

NB: The function the linker cannot find (kiss_fftr) is not a function from the global header of the library, but a function within the library, called by a global function of that library.

divide
5th December 2012, 13:24
Problem solved: I missed a define in the application .pro that was present in the library .pro - so the header code of the library wasn't exactly the same in the lib and app...