Home > Software design >  Qt include .lib; undefined reference to __imp__
Qt include .lib; undefined reference to __imp__

Time:02-21

I am working with Qt creator, Qt 5.15.0, and MinGW81 64bit.

This is my first application to include an external library (libe9u_LSMD_x64.bit) to communicate with a device. I was able to get the example source code running in Visual Studio, but I am stuck within Qt. I also tried the Qt VS Tools within Virtual Studio.

Under VS I get (with Qt VS Tools)

LNK2019 reference to unresolved external symbol

And in Qt creator

undefined reference to _imp_ ...

Within the .pro file, I included the lib as

win32:CONFIG(release, debug|release): LIBS = -L$$PWD/./ -llibe9u_LSMD_x64

else:unix: LIBS = -L$$PWD/./ -llibe9u_LSMD_x64

INCLUDEPATH = $$PWD/.

DEPENDPATH = $$PWD/.

I also tried renaming to .a as suggested in some other forum. It seems that the library is found and also the 64bit version is correct.

I am happy to provide more information, but since I am new with external libraries, I am not sure what is relevant to solve this.

Thanks in advance! Dan

CodePudding user response:

Some of the include files were written in C. Adding

extern "C"
{
#include ...
}

solved the problem. What a unspecific error message...

D

  • Related