0

I'm working with MSVC code in Qt Creator, and build this using the MSVC compiler. My code uses constructions like:

#pragma comment(lib, "mylib.lib")

How Can I instruct qmake, in the .pro file, to find these libraries? I thought that DEPENDPATH served this purpose, however this doesn't seem to work.

What should I be using instead?

P.S. Please do not tell me that is not a portable bad code, I know, that is not portable and that's ok

rubenvb
  • 74,642
  • 33
  • 187
  • 332
amigo421
  • 2,429
  • 4
  • 26
  • 55

1 Answers1

1

Qmake has the LIBS variable with which you can set search directories, and also even libraries to link. In your case, something like

LIBS += -Lpath/to/lib/directory -lmylib

would work and alleviate the need for the #pragma altogether. Note that although it uses Unix-like syntax (-L for library search directories and -l for lib names without the lib pre- and suffixes), qmake will make sure it does the right thing for MSVC as well.

rubenvb
  • 74,642
  • 33
  • 187
  • 332