qmake

Getting values from pro files in Qt

淺唱寂寞╮ 提交于 2019-12-04 09:01:23
问题 I am using Qt 4.5 in Windows XP. My pro file has the variable VERSION = 1.0 . Now i need to read this variable and get its value ( 1.0 ) from the source code. So that I don't have to maintain another variable for version inside my source code. I just read from the pro file and update it. So that the value remains consistent all over my project. Is it possible? Any pointers regarding this are welcome.. 回答1: Use somethings like this: DEFINES += VERSION=\\\"$$VERSION\\\" This will define a macro

Qt 5.3. QtWidgets: No such file or directory #include <QtWidgets>

╄→尐↘猪︶ㄣ 提交于 2019-12-04 05:52:21
I want to compile Qt example. I get error QtWidgets: No such file or directory #include greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - does not help QT += widgets - does not help INCLUDEPATH += /opt/Qt/5.3/Src/qtbase/include/ - does not help Qt 5.3. Ubuntu 14.04 x64. You need to double check that you completed all these steps: Module installed greaterThan(QT_MAJOR_VERSION, 4): QT += widgets You re-run the Qt 5 qmake. Having said that, I would like to remind you that including the whole module is not a good idea as it includes all the widgets related things. Try to narrow it down to the

qmake platform scopes

偶尔善良 提交于 2019-12-04 02:47:11
问题 A standard c++ qmake-based library is developed for Win32, Mac, and Linux. In the qmake project file, the platform-dependent sources are included like this: win32 { SOURCES += WinSystem.cpp HEADERS += WinSystem.h } macx { SOURCES += MacSystem.cpp HEADERS += MacSystem.h } unix { SOURCES += LinuxSystem.cpp HEADERS += LinuxSystem.h } Now on OS X both unix and macx are defined, so the Linux files are also included and cause error! What is the solution to this? 回答1: You can negate and combine

Preprocessor output on Qt Creator

谁都会走 提交于 2019-12-04 00:31:50
问题 I am compiling C code in Qt Creator and I need to look at the preprocessor output. I added the -E flag to the make, but I don't see the *.i files: mingw32-make.exe -e -w in \qt\qt-build-desktop Please help. 回答1: -E is a gcc option, not a make option, so passing it to make won't do anything. Also, using -E works fine for a single file, but will break your build as no proper .o file is generated (it contains the preprocessed source). What works fine though is adding the following to the .pro

How to avoid having version numbers in .so file name

百般思念 提交于 2019-12-03 23:39:36
I'm trying to build a dynamic library on Linux using qmake. Here is my .pro file: TEMPLATE = lib TARGET = sqxUiBase QT += core gui CONFIG += dll INCLUDEPATH += ../../public/include DEPENDPATH += . UI_DIR += ../GeneratedFiles RCC_DIR += ../GeneratedFiles CONFIG(release, debug|release) { DESTDIR = ../lib/release LIBS += -L"../lib/release" MOC_DIR += ../GeneratedFiles/release OBJECTS_DIR += release } else { DESTDIR = ../lib/debug LIBS += -L"../lib/debug" MOC_DIR += ../GeneratedFiles/debug OBJECTS_DIR += debug } include(sqxUiBase.pri) The sqxUiBase.pri file contains the list of files that need to

How to port a qmake project to cmake

孤街醉人 提交于 2019-12-03 21:57:41
I would like to "port" this C++ project , which uses qmake (i.e., a Tool.pro file) for building, to cmake . Essentially, I'm asking how to go about writing the necessary CMakeLists.txt file(s) by looking at the Tool.pro file above. This is what I've done so far: include_directories(../lib/cudd-2.5.0/include BFAbstractionLibrary) add_executable(slugs BFAbstractionLibrary/bddDump.cpp BFAbstractionLibrary/BFCuddVarVector.cpp BFAbstractionLibrary/BFCudd.cpp BFAbstractionLibrary/BFCuddManager.cpp \ BFAbstractionLibrary/BFCuddVarCube.cpp tools.cpp synthesisAlgorithm.cpp synthesisContextBasics.cpp

How to build qt out of source

泪湿孤枕 提交于 2019-12-03 15:03:38
问题 I was searching a lot through Qt forums and Google for the last few days, but I could not find any obvious answer to this question. I found the -prefix option (not even documented on Windows) that can be supplied to configure to specify different install directory, but this is not clear separation of the sources and binaries at all, since the build is still done in the source directory and then the files needed for installation are copied to the install directoy. I tried this -prefix option,

Is it possible to use Qt Creator without qmake?

扶醉桌前 提交于 2019-12-03 14:41:46
I've heard that it is possible to build non-Qt applications (like simple C++ HelloWorld) with Qt Creator. I downloaded and installed Qt Creator, and tried to compile simple code with it. But I didn't succeed: Creator needs qmake to create makefile. Although the package I downloaded includes MinGW, there is no qmake inside of it. I still want to use it just like an IDE to create simple C++ sources and compile them with MinGW. Is it possible to use Qt Creator without installing whole platform? Qt Creator support CMake projects, you just need to choose Open a file or project and select the root

How do I make apps smaller with qmake and macdeployqt

六眼飞鱼酱① 提交于 2019-12-03 14:26:47
How do I make apps smaller with qmake and macdeployqt? I have set QT = core gui in the projects .pro file and run qmake and macdeployqt on the resulting app. The problem is that the program is bundling QtNetwork, QtScript, QtSvg etc. I've tried setting QT -= network script svg (and then make clean, rm -rf *.app, qmake, make). In total the app is 32 MB. .pro file: TEMPLATE = app TARGET = throw DEPENDPATH += . INCLUDEPATH += . CONFIG += x86_64 release QT = core gui unix { CONFIG += link_pkgconfig PKGCONFIG += glib-2.0 } # Input SOURCES += main.cpp # Headers HEADERS += throw.h RESOURCES += throw

Get qmake to execute shell script after build finished on Mac

若如初见. 提交于 2019-12-03 14:17:29
After my release build is finished I would like to run a script. I found this question How to execute shell command after compile finished from .pro in QT? but the answer doesn't work for me. I tried adding various modifications of this to my .pro file: CONFIG(release, debug|release) { mytarget.target = ./MyScript.sh mytarget.commands = touch $$mytarget.target QMAKE_EXTRA_TARGETS +=mytarget QMAKE_POST_LINK += mytarget } But this always results with ":-1: error: mytarget: No such file or directory". Path is correct and 'MyScript.sh' works fine from command line. Since this works for other