Home > Mobile >  Call on dynamic library DLL
Call on dynamic library DLL

Time:09-21

, ladies and gentlemen, please help me, I'm calling dynamic library, it is always an error: : 1: error: LNK1104: unable to open file "XXX. Lib", I call the dynamic library steps are as follows:
1. In the project directory to create a DLL file, used to store the library files: mainly include XXX. DLL library, XXX. Lib library
2. Specify the path of the dynamic libraries:
LIBS +=L $$PWD/DLL/- LXXX
3. The external libraries through QtCreator selection to specify the library path, the code is as follows:
Win32: CONFIG (release, the debug | release) : LIBS +=L $$PWD/DLL/- LXXX
Else: win32: CONFIG (debug, the debug | release) : LIBS +=L $$PWD/DLL/- LXXX

INCLUDEPATH +=$$PWD/DLL
DEPENDPATH +=$$PWD/DLL
4. Put the corresponding header file in project directory,
5. Compile run
Above, could you tell me where is wrong? DLL and static and dynamic library. Library. Lib is must be the same library name?

CodePudding user response:

The else: win32: CONFIG (debug, the debug | release) :
Suggest all these judgments, give it a try first, I found that the judgment of the pro is very abnormal, and then try the curly braces,

CodePudding user response:

reference 1st floor 丁劲犇 response:
else: win32: CONFIG (debug, the debug | release) :
Suggested the judge went to try it, I found that the judgment of the pro is very abnormal, and then try the curly braces,
this is generated directly with qtcreator add external libraries, you mean the else: win32: CONFIG (debug, the debug | release) : take out, leaving only LIBS +=L $$PWD/DLL/- LXXX?? Such as if it won't work,

CodePudding user response:

refer to the second floor lwei2 response:
Quote: refer to 1st floor 丁劲犇 response:
else: win32: CONFIG (debug, the debug | release) :
Suggested the judge went to try it, I found that the judgment of the pro is very abnormal, and then try the curly braces,
this is generated directly with qtcreator add external libraries, you mean the else: win32: CONFIG (debug, the debug | release) : take out, leaving only LIBS +=L $$PWD/DLL/- LXXX?? So if it won't work right,


If you debug and release the contents of the written, it was just like write a effect only!
And if this is automatically generated, is certainly not remove the "add 'd' to the debug version as the suffix"
So you should have a look at whether in the debug, there is - LXXXD not - LXXX, so it will find XXXD. Lib

CodePudding user response:

Look at XXX. Whether the lib is damaged, you can open the Visual Studio, build a simple project, then test is feasible,

CodePudding user response:

Lib is not necessarily a static library library, in most cases only DLL derivatives, namely DLL export list description file, we usually put the lib files in the lib directory, the DLL will be put into the bin directory, and then in the pro file only to find the lib directory,

CodePudding user response:

In my experience you "- LXXX" Qt linker actually looking for is libxxx lib and direct links to XXX. Lib is not using "- LXXX"

CodePudding user response:

I don't know, what is your library catalog is wrong or,
If is the library file name, under different compilers, unclear exactly is pinched head or tail,
You can take a look at this: "pro file LIBS usage in detail"
  •  Tags:  
  • Qt
  • Related