0

I want to build my program(developed with QT 5.0.2) and give it to some friends.

How can I process?

I tried qmake -project and qmake in my folder with the *.cpp files, but it didn't create any exe.

This is my .pro file

#-------------------------------------------------
#
# Project created by QtCreator 2013-08-03T18:53:41
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = target
TEMPLATE = app


SOURCES += main.cpp\
        class1.cpp\
        class2.cpp\
        class3.cpp\
        class4.cpp

HEADERS  += class1.h\
            class2.h\
            class3.h\
            class4.h

FORMS    += class1.ui\
            class3.ui
Niklas
  • 23,674
  • 33
  • 131
  • 170

2 Answers2

1

Have you compiled your QtSDK statically? if yes, you can build your project as static linking, either you can't, if your are manually download your Qt repository from qt-project.org, it is a shared version of Qt, you should remove the line contain CONFIG += static and compile your project as shared and add the line below to your .pro file:

QT    += core gui

Note:

Use Qt Creator as Qt Framework IDE to manage and build your projects, it's really handy and great tool, another way is use Visual Studio Add-In that integrates with VStudio, if you are professional in Qt architecture, you can use makefile base building of Qt withqmake.

Reza Ebrahimi
  • 3,623
  • 2
  • 27
  • 41
  • Yeah I downloaded my QT from qt-project.org. How can I compile my project as shared? – Niklas Aug 03 '13 at 06:28
  • acutally my `.pro file` was wrong (I think, qmake overrode it). I updated it. How am I supposed to build my project? If I click on the build button(left corner down), he will build it, but the release folder is empty. If I go to the debug folder and copy all this shit, I can execute it, but I want something small and not all the cpp files and so on in a folder. – Niklas Aug 04 '13 at 02:05
  • yes, you can build it with debug or release mode, but this is shared compile, you must copy required DLLs to your app folder, but if you want to static build, you need to static compile of Qt repository, but there is some bugs in static build of Qt with the versions 4.8 and above (I'm not trying Qt new released version 5.1!), the reported bugs in here : http://stackoverflow.com/a/16198914/1789729 but version 4.7 works for static build. – Reza Ebrahimi Aug 04 '13 at 03:45
  • I hadn't to copy some DDLs. I just copied the complete Folder `C:\QT\\workspace\build--Desktop_Qt_5_0_2_MinGW_32bit-Debug\debug` to somewhere else and could execute it. Is there an opportunity to merge all the files and have like `one big .dll` and `1 .exe`? – Niklas Aug 04 '13 at 08:35
  • No, you should use shared library, read this answer: http://stackoverflow.com/a/15569097/1789729 – Reza Ebrahimi Aug 04 '13 at 09:37
0

Tutorial for building project on Windows

Niklas
  • 23,674
  • 33
  • 131
  • 170