Qmake .Pro File Not Parsed Correctly to Generate Ld_Library_Path

Qt5.5 qmake don't generate proper .pro file

core and gui are added by default, however, widgets is not. This info is clearly stated in the documentation.

Project MESSAGE: You are running qmake on a generated .pro file. This may not work

Project Message: usually indicates that the following text was printed in the qmake file using message(text).

In that case, your best hope is to grep for the message in all .pro files, find out where it comes from and asking your colleague what that message is supposed to mean if you can't figure it out.

Edit: I just found out that the Qt Visual Studio Integration puts this message in autogenerated qmake files. If you or your colleague are using the VS integration, you could remove that message if you do not intend to re-generate the .pro file. The message is basically there to tell you that you might have to adjust some things to make the project build correctly (which it seems to do in your case).

In that case, the code generally looks like this:

# ----------------------------------------------------
# This file is generated by the Qt Visual Studio Add-in.
# ------------------------------------------------------

# This is a reminder that you are using a generated .pro file.
# Remove it when you are finished editing this file.
message("You are running qmake on a generated .pro file. This may not work!")

Variables that persist across .pro files from a subdirs pro file

Another option is to place the common variables in a file called ".qmake.cache" stored in the root dir of the project. This way you don't need to include any .pri files in the subdir projects.

Qt C++: Include all library files in project folder

You're including lib (from library file name) in your LIBS. Try this:

BASENAME = $$basename(FILE)
LIBNAME = $$replace(BASENAME, lib, )
LIBS += -l$$replace(LIBNAME,\.so,)

At least for unix, convention says to omit the lib prefix of the library file name (e.g. libname.so => -lname)

Update, based on the compile output you posted:

Looking at the line that starts with g++, you succeeded in providing the lib directory to the linker

-L/media/omari/EXT/Programación/Qt\ Creator/PocketList/lib/ 

but failed to pass the libraries, since the only ones I see are those:

-lQt5Multimedia 
-lQt5Widgets
-lQt5Gui
-lQt5Network
-lQt5Core
-lGL
-lpthread

Check that the directory is the one, and it contains the needed files.
Also, use message() function in your pro file, to debug it.
For example:

message( LIBNAME )

Qt: .pro file missing?

TL;DR: Use cmake. Forget about qbs and qmake.

Whenever I create a new project - doesn't matter whether its with qbs, qmake, or cmake - the project structure/ folder is lacking the '.pro' file.

A qmake project will have the .pro file, since that's the project file for qmake. Maybe you're looking in a wrong place? A qbs project will have a .qbs file, since that's what qbs uses. A cmake project will have CMakeLists.txt, since that's what cmake uses. It all works for me.

I'm just confused by all these guides stating that I have to add QT += widgets sql in the .pro file.

Those guides only apply when you use qmake, since .pro are qmake project files.

I suggest that you use cmake, as qbs is abandoned now, and there's no benefit to using Qt-specific qmake over the widely supported and continuously developed cmake.

Qt documentation covers the basics of how to use cmake to build Qt projects.

Qt support is provided natively by cmake, and it thus provides a comprehensive reference page.

find out what qmake executable is used inside a pro file

I think this might be what you're looking for: http://doc.qt.io/qt-5/qmake-language.html#accessing-qmake-properties

$$[QT_INSTALL_BINS]/qmake should be the path.



Related Topics



Leave a reply



Submit