Frage

I have a Qt project using SQLite, so I have the following directory structure:

C:\Workspace\MyProject\MyProject.pro
C:\Workspace\MyProject\sqlite3\sqlite3.lib

Adding sqlite3.lib with absolute paths works fine:

LIBS += -L"c:/Workspace/MyProject/sqlite3" -lsqlite3

But I can't make it work with relative paths. I try with:

LIBS += -L"sqlite3" -lsqlite3

But that fails with:

:-1: error: LNK1104: cannot open file 'sqlite3\sqlite3.lib'

I tried but LIBS += -L"../sqlite3" or even LIBS += -L"../../sqlite3", but that didn't work either.

I'm using MSVC 2008 for the compiler toolchain.

War es hilfreich?

Lösung

Since it's possible to build from different directory than project directory, relative path pointing to project directory should be prefixed with $$PWD/ (PWD qmake variable contains absolute path to directory with currently processed *.pro file).

Your line would look like:

LIBS += -L"$$PWD/sqlite3" -lsqlite3
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top