Question


I have some problems linking a library using Qt Creator on Windows (MinGW). I have 2 projects, a static library and an application that uses it. The library uses a jpeglib and compiles fine. However, when I try to compile the app, it says undefined reference in the library project. I looked at the libjpeg symbols and their names are exactly the same as the ones used, so the problem must be with the linker (I tried to compile the libjpeg both with visual studio and mingw using msys, neither works with my projects).

In the library pro file I use:
LIBS += -L$$PWD/../../lib/libjpeg/ -ljpeg

and in the app pro file I use:
LIBS += -L$$PWD/../../lib/libjpeg/ -ljpeg
LIBS += -L$$PWD/../../bin/StegoDiskCore/ -lStegoDiskCore

I tried using PRE_TARGETDEPS in the app project insted of LIBS for the jpgelib but it says multiple target pattern (I don't know if PRE_TARGETDEPS is even viable in this case, I'm simply trying whatever I can think of, in the end, it might just be something stupid). If anyone could help, I've been stuck on that for quite some time and just don't know what else to try, thanks.

Was it helpful?

Solution

The libjpeg library header was including the library functions withou using the "extern C" which didn't work in my C++ projects.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top