Académique Documents
Professionnel Documents
Culture Documents
In this article, I will show you how to create a portable Qt developing environment on Windows platform. This practice is based on Qt 5.0.1 and MinGW 4.7.
Preparation:
1.
2.
1.
Install Qt 5.0.1 and MinGW 4.7 on your system. Make sure that you've selected MinGW 4.7 in Select Components page. I used c:\Qt for installation target.
2.
Copy C:\Qt to your USB drive. My USB drive letter is E. So, I copied c:\Qt to e:\Qt
3.
Steps:
set PATH=\Qt\Qt5.0.1\5.0.1\mingw47_32\bin;\Qt\Qt5.0.1/Tools/MinGW\bin;%PATH%
cd /D \Qt\Qt5.0.1\5.0.1\mingw47_32
4.
Copy msvcp100.dll and msvcr100.dll to E:\Qt\Qt5.0.1\Tools\QtCreator\bin\ (Make sure they are 32-bits version)
if you are using 32-bit Windows system, you can get them in C:\Windows\system32
if you are using 64-bit Windows system, you can get them in C:\Windows\SysWOW64
5.
6.
7.
Add compiler(Tools->Options->Build & Run->Compilers), Click on Add button and choose MinGW. Input following items.
Create a file named qt.conf with following contents and put it to the same folder which qmake.exe located.
[Paths]
Prefix = /Qt/Qt5.0.1/5.0.1/mingw47_32
NOTE: The path seperator used in qt.conf must be slash. Backslash is not allowed.
9.
Add Qt(Tools->Options->Qt Versions). Use ADD button to create a manual entry for new Qt version. Select the qmake.exe in
e:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin\qmake.exe
10.
Add Kit(Tools->Options->Kits). Use ADD button to create new kit. You need to select the Compiler and Qt Version which are created in step 7 and 9. Also, select
the E:\Qt\Qt5.0.1\Tools\MinGW\bin\gdb.exe as Debugger.
11.
12.
Go to E:\Qt\Qt5.0.0\Tools\QtCreator\settings\QtProject\qtcreator
13.
14.
Modify profiles.xml
1.
15.
Now, take your USB drive to another computer use qtcreator.bat to invoke QtCreator.exe.
16.
Create new project and try to compile it to see if your environment is okay.
NOTE: If you get the error `Failed to load platform plugin windows` when executing your new project, copy the qt.conf which created in step 8 to your program path. For
example, If your program output is d:\src\myapp\release, copy qt.conf to it.
First determine your Ubuntu Linux operating system bit version by opening up a terminal and
typing the following below and download the matching Qt SDK bit version for your operating
system. For example, if you are on 32-bit Ubuntu Linux then download 32-bit Qt SDK, if you are
on 64-bit Ubuntu Linux then download 64-bit Qt SDK.
Note the bit version of your Ubuntu Linux operating system architecture it will display
whether it is 32-bit or 64-bit.
Select your Ubuntu Linux system architecture such as 32-bit or 64-bit version of the Qt
SDK. Also you can add development libraries so that you are able to run Qt applications
without compilications by following these steps.
Note: When it comes to downloading the SDK, download the offline installation due to
the fact it takes a long time to download unless you have a really fast download
connection.
You have two methods when it comes to downloading the Qt SDK the online installer
method or the offline installer method. I prefer to just download the full SDK using the
offline method. Because the classes that make up Qt SDK are so large it takes several
hours on a slow connection to download the SDK. This may or may not be a turn off for
some users who want to try out the Qt SDK.
Suggestion: I would strongly recommend using the offline installer instead of the online
installer unless you have a really fast connection.
This command is used to update and to resynchronize the package index files from their
sources via the Internet.
This command adds additional Qt development libraries to your Ubuntu Linux system
allowing Qt programs to run smoothly on your system. I included this information just in
case you want to have Qt SDK 4.8 compatable libraries installed
4. Type/Copy/Paste: cd /home/"your_user_name"/Downloads
This will change you into the Downloads directory on your system
This will make the Qt SDK executable for all users on your system
7. When you install the Qt SDK you will prompted to select a directory where you want the Qt
SDK to reside. Select /opt and your Qt SDK will install into a directory called /opt/QtSDK
8. Change the permisions on the Qt SDK directory location to be available by all users by issuing
the following command
9. Type/Copy/Paste: sudo -s chmod -R 777 /opt/Qt5.0.2
This will make the Qt SDK executable for all users on your system
This will prevent error messages when you start QtCreator, stating it can not write to
the /home/"your_user_name"/.config/QtProject directory.
11. Once the Qt program is installed, open up a terminal and use a text editor such as nano or
gedit to edit your /etc/profile.
12. Scroll down to the end of the /etc/profile file and enter the following text below. You want to
add this line below to your /etc/profile system wide file so that you will have the option to
compile Qt programs from the terminal line.
13. Type/Copy/Paste:
PATH=/opt/Qt5.0.2/5.0.2/gcc/bin:$PATH
export PATH
14. The above number highlighted in bold denotes the version number of the Qt SDK so make
sure you enter the correct version number of the Qt SDK.The Qt SDK is always improving with
new version changes. So make sure you are mindful of your Qt SDK version number.
For example, we are using Qt version 5.0.2 in this example, therefore the version
number in the /etc/profile would reflect as 5.0.2
Type/Copy/Paste: . /etc/profile
Make sure you enter a . and then a space in order to reload your /etc/profile file
17. Once the /etc/profile file is reloaded issue the following command you can type the following
commands to make sure your Ubuntu Linux system recognizes that the Qt SDK has been
accepted by the system PATH.
18. Type/Copy/Paste: which qmake
/opt/Qt5.0.2/5.0.2/gcc/bin/qmake
21. This lets you know that you are able to compile Qt SDK 5.0 programs from the command line.
Now you are all set to compile Qt programs on your Ubuntu Linux system. Once the Qt SDK is
successfully installed on your system you might want to try compiling your first Qt program see
this document for more information How to Create Your First Qt Program on Ubuntu Linux.