qmake

How to add custom targets in a qmake generated Makefile?

醉酒当歌 提交于 2019-11-26 21:47:53
问题 Today when I play with Qt I use qmake to generate the Makefile, and that works quite well. However sometimes I want to add more stuff to the generated Makefile, without having to edit the generated Makefile. Let's say that we beside the source code have a Doxygen directory, and there I need to run some doxygen commands to generate the documentation. So it would be nice to have this as a target in the main Makefile. But as default qmake do not understand this type of extra stuff. So can I add

How to create a subdirectory for a project QtCreator?

ぐ巨炮叔叔 提交于 2019-11-26 19:04:19
问题 I would like to divide my Qt project into several directories because it is growing pretty large. However, when I click on browse in QtCreator, there is no 'Add directory' and no such thing in 'Add new'. Can this be done somehow? 回答1: One method you could use is to add a project include file for each sub directory. Qt Creator displays these in the GUI in a nested fashion, and allows you to add files to them. e.g. in project.pro include(folder1/include.pri) in folder1/include.pri HEADERS +=

Undefined reference to vtable. Trying to compile a Qt project

南楼画角 提交于 2019-11-26 18:57:21
I'm using Code::Blocks 8.02 and the mingw 5.1.6 compiler. I'm getting this error when I compile my Qt project: C:\Documents and Settings\The Fuzz\Desktop\GUI\App_interface.cpp|33|undefined reference to `vtable for AddressBook' File AddressBook.h: #ifndef ADDRESSBOOK_H #define ADDRESSBOOK_H #include <QWidget> class QLabel; class QLineEdit; class QTextEdit; class AddressBook : public QWidget { Q_OBJECT public: AddressBook(QWidget *parent = 0); private: QLineEdit *nameLine; QTextEdit *addressText; }; #endif File AddressBook.cpp: #include <QtGui> #include "addressbook.h" AddressBook::AddressBook

QMake - how to copy a file to the output

让人想犯罪 __ 提交于 2019-11-26 18:36:10
How can I copy a file from my project to the output directory with qmake? I'm compiling on Linux but in the future I'll compile it on Mac and Windows. Here's an example from one of our projects. It shows how to copy files to the DESTDIR for Windows and Linux. linux-g++{ #... EXTRA_BINFILES += \ $${THIRDPARTY_PATH}/gstreamer-0.10/linux/plugins/libgstrtp.so \ $${THIRDPARTY_PATH}/gstreamer-0.10/linux/plugins/libgstvideo4linux2.so for(FILE,EXTRA_BINFILES){ QMAKE_POST_LINK += $$quote(cp $${FILE} $${DESTDIR}$$escape_expand(\n\t)) } } win32 { #... EXTRA_BINFILES += \ $${THIRDPARTY_PATH}/glib-2.0

Qmake: how to remove compiler flag for a certain project, without changing qmake.conf?

一笑奈何 提交于 2019-11-26 17:14:01
问题 I'm using qmake and Visual Studio. In release build qmake adds /GL and /O2 flags to all projects, and I need to remove those two flags for certain libraries within my whole Qt project. Is there a way? 回答1: The only way this could work is QMAKE_CFLAGS -= /GL /O2 but I doubt this works for QMAKE_CFLAGS . Alternatively, you could redefine QMAKE_CFLAGS , forgetting its previous value: QMAKE_CFLAGS = $$CFLAGS_WITHOUT_GL_O2 回答2: I had a similar problem and I solved it by adding the following

How to specify different Debug/Release output directories in QMake .pro file

一笑奈何 提交于 2019-11-26 16:56:52
I have a Qt project and I would like to output compilation files outside the source tree. I currently have the following directory structure: / |_/build |_/mylib |_/include |_/src |_/resources Depending on the configuration (debug/release), I will like to output the resulting files inside the build directory under build/debug or build/release directories. How can I do that using a .pro file? The short answer is: you don't . You should run qmake followed by make in whatever build directory you want to build in. So, run it once in a debug directory, once in a release directory. That's how anyone

How can I use C++14 features when building qmake projects?

自闭症网瘾萝莉.ら 提交于 2019-11-26 14:28:15
问题 I'm currently using C++11 features in my Qt applications. However, I'd like to use some of the new C++14 features in my applications. To enable C++11 in a Qt application, one only needs to add one line in the qmake project file, namely: CONFIG += c++11 or this for earlier versions: QMAKE_CXXFLAGS += -std=c++1y I already tried to do the same with C++14, but it didn't work. I changed the above mentioned line of the qmake project like this: CONFIG += c++14 or this for earlier versions: QMAKE

Add a define to qmake WITH a value?

两盒软妹~` 提交于 2019-11-26 10:57:11
问题 How do I add a define with qmake WITH a value: For example, this does not work (as I expected) in my .pro file: DEFINES += WINVER 0x0500 nor DEFINES += \"WINVER 0x0500\" How do I define WINVER as 0x0500 before anything starts compiling so it\'s definition is not affected in any way by compilation or include order? 回答1: DEFINES += "WINVER=0x0500" works for me. This way, -DWINVER=0x0500 is added to the command line of the compiler, which is the syntax GCC/mingw expects for command line

How to use QMake&#39;s subdirs template?

为君一笑 提交于 2019-11-26 07:57:32
问题 I\'m starting to learn Qt. I\'m moving from the Visual Studio world and I am looking for a way to organize my project\'s structure using QMake. I\'ve found the \'subdirs\' template but I have quite a hard time understanding it. My project structure looks like this: project_dir/ main.cpp project.pro logic/ logic.pro some logic files gui/ gui.pro gui files My project.pro looks like this TEMPLATE = subdirs SUBDIRS = logic \\ gui SOURCES += main.cpp In the .pro files for the subdirectories I have

Undefined reference to vtable. Trying to compile a Qt project

∥☆過路亽.° 提交于 2019-11-26 06:44:15
问题 I\'m using Code::Blocks 8.02 and the mingw 5.1.6 compiler. I\'m getting this error when I compile my Qt project: C:\\Documents and Settings\\The Fuzz\\Desktop\\GUI\\App_interface.cpp|33|undefined reference to `vtable for AddressBook\' File AddressBook.h: #ifndef ADDRESSBOOK_H #define ADDRESSBOOK_H #include <QWidget> class QLabel; class QLineEdit; class QTextEdit; class AddressBook : public QWidget { Q_OBJECT public: AddressBook(QWidget *parent = 0); private: QLineEdit *nameLine; QTextEdit