Qmake and prl files
-
I am trying to get my head around how prl files work. Working on a Windows machine, I have created two static libraries, lib1.lib (exporting
void my_lib1_func()
) and lib2.lib (exportingvoid my_lib2_func()
which usesmy_lib1_func
). I then create a console app which I link statistically against lib2.lib. Unfortunately, when trying to compile it the compiler complains that it can't findmy_lib1_func
.I was under the impression that qmake's prl files would tackle this issue as explained here, but unfortunately I haven't been successful using it. Below is the source code, there are a few files but they are trivial. The directory structure structure is as follows:
root |---my_lib1 |---my_lib1.pro |---my_lib1.cpp |---my_lib1_header.h |---my_lib2 |---my_lib2.pro |---my_lib2.cpp |---my_lib2_header.h |---main |---main.pro |---main.cpp //my_lib1_header.h #pragma once void my_lib1_func(); // my_lib1.cpp #include <iostream> #include "my_lib1_header.h" void my_lib1_func() { std::cout << "Hello" << std::endl; } #my_lib1.pro TEMPLATE = lib HEADERS += my_lib1_header.h SOURCES += my_lib1.cpp TARGET = my_lib1 CONFIG += static create_prl CONFIG -= qt //my_lib2_header.h #pragma once void my_lib2_func(); //my_lib2.cpp #include "../my_lib1/my_lib1_header.h" #include "my_lib2_header.h" #include <iostream> void my_lib2_func() { my_lib1_func(); std::cout << "World" << std::endl; } #my_lib2.pro TEMPLATE = lib SOURCES += my_lib2.cpp CONFIG += static link_prl create_prl CONFIG -= qt CONFIG(debug, debug|release) { LIBS += ../my_lib1/debug/my_lib1.lib } CONFIG(release, debug|release) { LIBS += ../my_lib1/release/my_lib1.lib } // main.cpp #include "../my_lib2/my_lib2_header.h" int main() { my_lib2_func(); } #main.pro TEMPLATE = app CONFIG -= qt CONFIG += console link_prl CONFIG(debug, debug|release) { LIBS += ../my_lib2/debug/my_lib2.lib } CONFIG(release, debug|release) { LIBS += ../my_lib2/release/my_lib2.lib } SOURCES += main.cpp
The resulting Makefile for main.cpp links against the
my_lib2.lib
but not againstmy_lib1.lib
, despite the prl file being generated. Any help would be appreciated! -
I'd be interested to know if you came up with a solution for this, as I've also run up against the same problem. In our project, we've ended up having every of the dependent libs specified in the pro files which is not ideal.