Qt cross compile - qt

I am trying to cross compile a Qt4 application on Linux for Windows. I need to create an .exe (32 bit) from a Qt project, and I'm compiling under Linux (32 bit). Note that I'm not using Qt Creator, I am compiling with qmake.
I tried following many other tutorials/answers but I can't seem to make it work. Some suggest that I need MinGW but I can't find it for my platform (PCLinuxOS). Does anyone know where I can get it? Is there any other solution (apart from using Wine/Windows)?
I already have a copy of the headers and DLLs from Qt4 for Windows.

MXE does exactly what you want. It cross compiles to Windows. It comes with Qt, as well as many other libraries.
It's much easier to use than setting up a MinGW compiler on your own. You can start building in a matter of minutes, rather than spend the whole day setting up a cross compiler manually.

Related

QT application on BeagleboneBlack

Hi I have a debian image on BBB I have already installed QT creator on B^3 but the problem is whenever I try to start a new project in qt creator, couldn't see any option of kit. Infact when i add qmake and compiler path the application throws error.
What can I do to solve the problem. Can i directly get the full pack of SDK from qt.io/download ?
You must compile Qt libraries for your device (BBB) on your own, using specified compiler. You can find more information on this topic, here:
Qt Cross-Compilation Options
As soon as you compile Qt libraries for your device, you must move them to appropriate directories (on your BBB).
First, I would suggest learning to cross-compile, it's much faster & more easily maintained when you want to move to new versions. There's a ton of documentation and community around doing this. Windows & Linux both of which are probably dated, but info is still relavent. I've heard it's much easier from a linux host, but that could be biased.
That being said, if you don't want to cross-compile I believe you can simply install the qt embedded libraries. This question may offer some good advice. Once you have the libraries installed, you should be able to use qmake directly to create the Makefile for your project, then you can use cmake, or g++, etc.. to do the actual compiling.
You're likely going to work in command line though, I'm not sure you can run QT Creator on the BBB directly. I could be wrong.

Compiling Qt5: Adding a postfix to the Qt libs and dlls (-qtlibinfix)

I am in the process of upgrading from Qt4 to Qt5.
When I compiled the Qt4 sources I used to configure like this:
configure –qtlibinfix _64_
We did this for the x64 build so that the resulting Qt dlls would be renamed QtCore_64_.dll etc...
We are supporting both 64 and 32 bit builds and this made it a lot easier for us.
However, now with Qt5 it seems the -qtlibinfix option is gone. Is there an equivalent? Or another way a similar thing can be accomplished.
I have been scouring the Qt doc, and I have not found anything yet. Any help would be appreciated.
I'm also porting an app from Qt4 to Qt5. -qtlibinfix works for me as expected on Windows, building Qt 5.4.0.

Qt3 on Windows?

I need to port one of my old program to Windows. The current version uses Qt 3 on Linux.
I'd like to see it within few days only to do some tests.
Instead of porting my code on Qt 4 (no time now), is it possible to recompile on Windows with Qt 3? Do I also need minGW? Which problems may I have doing this porting?
I can't find Qt 3 for windows, can someone give me a link? or I can use the same qt source I use on Linux?
Yes, you can !
Download the qt-win-3.3.x-8 project on Sourceforge.
QT4 still has back-compatible QT3 classes, prefixed with Q3* (see http://qt-project.org/doc/qt-4.8/qt3support.html)
You should be able to compile & run you QT3 app on QT4 via those classes with minimal adaptations.
Qt-3.2 for Windows was also distributed in a CD bundled with the book "C++ GUI programming with Qt3" at no additional cost with a license for non-commercial use.
ISBN: 978-0131240728
The supported compilers were MSVC and Borland. MingW is not mentioned.

Is there a way to run Qt Creator from command line supplying a .pro file to open (or how do we deal with multiple Qt installations)?

I have multiple installations of Qt4 on my Windows XP SP2 machine and have installed Qt Creator 2.1 today. However, running the project (.pro) files spawns the oldest version of Qt Designer installed (the one installed in 2009 together with the rest of the framework).
Since
I would not like to remove any previous installations of Qt
and for some obscure reason even if I explicitly ask Windows Explorer to always use the version I need it does not
I would like to give up a bit and just sript the needed behaviour in a .bat file like:
e:\path\to\qtcreator.exe %1
This opens Qt Creator, but something seems to prevent it from treating the .pro file properly (in short, the project does not "open" as it should).
Qt documents have a page on the matter at Qt Creator: Using Command Line Options, but it seems to ignore the topic in question.
Since Qt (being as excellent framework as it is) is also known to have its quirks (like that of qmake), I wonder, may be there is an undocumented way to solve my problem?
(Another way to fix the thing would of course be to make the correct version of Qt Designer run, but frankly I'd prefer the "hard-wired" solution since the mechanisms provided by Qt itself are still a bit unreliable.)
The libraries and tools used for a particular project (and a configuration in it) is set in the Projects panel in Qt Creator:
http://doc.qt.io/qtcreator/creator-build-settings.html
Selecting the Qt version to use with a project should force it to run the Designer that's part of the version. If it doesn't, then you should report it as a bug.

Qt create executable

Is there a quick, straightforward way to make a Qt application into an executable? I attempted to follow the instructions at http://doc.qt.digia.com/4.1/deployment-windows.html but have been unsuccesfull thus far; I'm unable to Any help would be much appreciated. Thanks!
I always use CMake to build Qt projects, it's easy, free and cross platform. Guide : Compiling Qt4 apps with CMake. CMake also come with CPack to easly make installer for Windows, Mac and Linux.
I agree with chmod700 about the Qt Creator suggestion, it's not my favorite IDE but it's still really nice and easy.
Do you mean an installer package? I assume you are able to compile, link, and run your app and you mean how do you package it up for others.
http://installbuilder.bitrock.com/ <-- special handling of Qt based projects but costs $
http://www.jrsoftware.org/isinfo.php <-- my personal favorite and it's free (can be rough to learn advanced features though)
Though if you mean how do you build your app, you may want to try the new Qt Creator (http://www.qtsoftware.com/products/appdev/developer-tools/developer-tools#qt-tools-at-a) which will setup build targets for you and really makes desktop Qt dev a snap. Also if you're still using 4.1, you can now use 4.5 under the LGPL on all platforms making it almost a no-brainer to upgrade.
I'm not sure if I understand your problem. Assuming you're using MinGW, it's really easy and quite straightforward:
get the Qt sources and unpack them to some folder (f.e. c:\Qt\4.5.0-static)
install MinGW. Make sure the MinGW executable folder is in the %PATH% variable.
open a cmd windows, go to the Qt sources and run configure -static. You can add other config options if you like to, but usually you don't need that.
when building Qt finished, go to your application sources, open a cmd window and run the qmake of your built Qt installation -- i.e. c:\Qt\4.5.0-static\bin\qmake in the example given above.
run make
you get a statically linked binary in the end (you might want to check it with Dependency Walker).
Doing the same using Visual Studio is pretty similar.
Or do you want to build dynamically and create an installer package?

Resources