Static build in Qt on Windows Vista - c++

I am currently running Windows Vista Home Premium, and I have developed an application with my friend using Qt Creator. We are now trying to deploy our application as just one executable, so we are trying to do a static build. We have added CONFIG += static in our .pro file.
We are using this documentation to help us:
http://doc.trolltech.com/4.1/deployment-windows.html
When I try to build QT, I use this command:
configure -static -platform win32-msvc
Then I get this error:
Creating qmake...
execute: File or path is not found (nmake)
execute: File or path is not found (nmake)
Cleaning qmake failed, return code -1
I think I have to add nmake to my PATH, but I can't find it on my computer. Any help would be greatly appreciated. Thank you.

You will find a batch file under the bin directory of your visual studio install called "vcvars32.bat". Run that from the command line before you try building QT. That should solve your problems.

Open Visual Studo 20xx Command Prompt and compile Qt inside it!
For instance, on VS2008 I also need to set QMAKESPEC before trying to configure Qt:
set QMAKESPEC=<QT_DIR>\mkspecs\win32-msvc2008

Related

Cannot Run Compiler 'cl' for qt5.10.1 on Windows 10 in terminal

I have never used qt before, but I got a task to build an already existing application for Windows and Mac using the newest version of qt. What I have done so far is:
Installed Visual Studio Professional 2017.
Installed the latest Qt 5 Open Source.
Note: when installing the QT 5 I installed all of the components under QT/ QT 5.10.1 which were: qt 5.10.1 components and under QT/Tools I installed QT Creator 4.6.0 CDB Debugger Support and MinGW 5.3.0 : qt 5 Tools
I cloned the branch from GitHub that I wanted to build to C:/Projects
Then in Git Bash I cd to the project and tried to run qmake. The first time I had this problem:
"bash: qmake: command not found"
After searching into the problem I found out that I haven't added "Qt/5.10.1/msvc2017_64/bin" to PATH and I added it. Now when I echo $PATH I can see the directory added.
Now after bash recognises qmake and I try to run it it says:
Project ERROR: Cannot run target compiler 'cl'. Output:
===================
Maybe you forgot to setup the environment?
I have no idea how to fix the problem due to the fact that I have never used QT to build anything before. Can you help me?
In the read me file for the application I am trying to build it says:
Step-by-step instructions
1. Clone this branch
2. cd into the project
3. Run qmake - this wil generate Makefiles for all of the project's modules
4.Run make (Use the -j4 of -j flags - this greatly speeds up the build process - see the manual page for make for more info). You can also use the -s flag to silence the output - this also wins you a few seconds.
I am a bit puzzled by the instructions, it does not say to run qmake -project anywhere, but there is a qt project file in the directory that I cd to. Does this mean that I don't have to run qmake -project?
Also I have no idea how to run make by using the -j4 and -j flags and how to run flags in general. Could someone help me?
I believe that for the Cannot Run Compiler 'cl' issue I have some kind of a problem with the set up. Did I install too many components or is it to do with the VS setup?
I highly recommend you to install Qt from the Qt installer, and to use Qt Creator.
However, if you want to use it from source, you first need to get a compiler (ex: MinGW). Then you need to execute the instructions, but you need to use a MinGW (or whatever compiler you use) command prompt, which will automatically set the environment variables needed.
Note that this is Windows specific. On mac and linux, the compiler's environment variables are already set in the default command prompt (if there is a compiler, obviously).

Configuring Qt Command Prompt

I'd like to run my Qt application as a standalone executable. I know that I have to configure Qt to build static applications to do this and have added the line of code for this to my .pro file but I cannot get the Qt command prompt to work in order to complete the configuration.
The command prompt mentions I need to call vcvarsall.bat to complete environment setup. Could I get some pointers on how to get this batch file to run and what other steps I need to complete to build static applications. I'm using version 5.3 and the compiler is MSVC 2012.
Edit: I've found the vcvarsall.bat file and tried running it by dragging and dropping it into the cmd window but it was not recognised.
To setup your environment using vcvarsall.bat you need to run it like
%COMSPEC% /k "C:\path\to\vcvarsall.bat"
Few simple steps to build static Qt would be:
cd C:\path\to\Qt
configure.exe -static -release
nmake
Explaining how to build static Qt applications is beyond this SO question. Please proceed to http://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows.

Qt: Error while compiling Qt 5.0.1 on Windows, Visual Studio 2010 (VS2010)

I'm trying to compile Qt 5.0.1 for Windows under Visual Studio 2010 (VS2010), because of the famous problem with OpenGL, where the only the ES version of OpenGL is with the precompiled version of Qt.
I'm getting the error at qeglplatformcontext_p.h:
fatal error C1083: Cannot open include file 'EGL/egl.h': No such file or directory
However, the designated file and directory exist in the 3rdparty files of the Qt source in qtbase\src\3rdparty\angle\include.
The Qt I'm using is qt-everywhere-opensource-src-5.0.1.zip
The steps I follow for compiling are
1- extract files in D:\Qt\Qt5.0.1
2- Open Visual Studio Command Prompt
3- Run the following commands in the directory mentioned in step 1:
set QMAKESPEC=win32-msvc2010
set QTDIR=D:\Qt\Qt5.0.1\qtbase
set PATH=%PATH%;D:\Qt\Qt5.0.1\qtbase\bin
configure -opensource -debug-and-release -developer-build -accessibility -opengl desktop -openvg -platform win32-msvc2010
..\jom\jom.exe -j 32
And then happens the error of EGL/egl.h after approx. 5 minutes.
What should I do to fix this compile error? Please advise.
Another question I have is about exceptions. How can I enable exceptions in this version of Qt? The command -exceptions or -no-exceptions is not valid anymore. Any ideas?
Thanks for any efforts.
I could fix it. I downloaded the repository version using Git, and then used the following commands and it worked. Probably downloading it from the repository wasn't necessary, but this is what I got working so far (still compiling since half an hour with no errors).
set QMAKESPEC=win32-msvc2010
set QTDIR=D:\Qt\Qt5.0.1
set PATH=D:\Qt\Qt5.0.1\bin;%PATH%
configure -debug-and-release -opensource -platform win32-msvc2010 -exceptions
C:\Qt\jom\jom.exe -j 32
this will include OpenGL and the other libraries by default. It's not necessary to define them explicitly.
Good luck guys :)

Using QtMobility in QtCreator: Setup?

I am trying to set up a development environment to play around with developing Qt apps for Symbian devices. I have succesfully set up the environment and am able to create simple apps such as HelloWorld and get them to run on my device. I would now like to try using the QtMobility package, but I am struggling to get it to work in QtCreator.
I got some sample code for using the camera (initially I only had QtMobility 1.0.2, but I have now downloaded the 1.1.0 technology preview version). I followed the instructions in the help file to install it, here is what I did:
Extracted the zip file to C:\QtMobility
Opened a Qt Command prompt and ran configure (in the QtMobility directory)
Ran mingw32-make
Ran mingw32-make install
Finally I updated my PATH variable to include C:\QtMobility\lib
I went back to QtCreator (restarted it) and looked at the cpp file that first calls the macro QTM_USE_NAMESPACE but it is still underlined in red, because it can't find the qmobilityglobal.h file.
Does anyone know if I have missed anything out during the installation that will tell the QtCreator where to find the QtMobility header files?
mingw32-make suggests you're building for win32-mingw target environment. To work with Symbian SDKs, you should be building for e.g. symbian-abld instead. The configure.bat script will auto-detect the target you are building for. Just make sure that QT_PATH environment variable points to a location where you have a Symbian build of the Qt toolchain.
(Also note that make install is unnecessary with symbian-abld - the build step already puts everything in place in Symbian SDK directories.)

Qt installation error

i got an error when am trying to configure Qt.
Erro :
execute: File or path is not found (nmake)
execute: File or path is not found (nmake)
Cleaning qmake failed, return code -1
// installion files.
InterBase...............no
Sources are in..............E:\xampp\Qt\4.6
Build is done in............E:\xampp\Qt\4.6
Install prefix..............E:\xampp\Qt\4.6
Headers installed to........E:\xampp\Qt\4.6\include
Libraries installed to......E:\xampp\Qt\4.6\lib
Plugins installed to........E:\xampp\Qt\4.6\plugins
Binaries installed to.......E:\xampp\Qt\4.6\bin
Docs installed to...........E:\xampp\Qt\4.6\doc
Data installed to...........E:\xampp\Qt\4.6
Translations installed to...E:\xampp\Qt\4.6\translations
Examples installed to.......E:\xampp\Qt\4.6\examples
Demos installed to..........E:\xampp\Qt\4.6\demos
Creating qmake...
execute: File or path is not found (nmake)
execute: File or path is not found (nmake)
Cleaning qmake failed, return code -1
E:\xampp\Qt\4.6>
If you are trying to build Qt with a Visual Studio enviroment, you have to make sure that nmake and cl are in the PATH.
The easiest way to do that is to simply use the Visual Studio Command Prompt (found e.g. in the start menu).
You need to change your path so that it leads to wherever nmake is.
Try adding the flag "-make nmake" to your configure command.