Silex
Silex

Reputation: 2713

Write windows specific .pri file for Qt application

I am trying to build a Qt 5.5 application on Windows 8.1. I manged to build the same application on both Ubuntu 14.04 and MacOS 10.10.2.

This is how the .pri file looks like right now: http://pastebin.com/USHBXAni. It has both unix and mac support. I tried to add windows support too, but it is not working. It looks like this:

win32 {

INCLUDEPATH += $$PWD \
   C:/Program Files (x86)/PCL 1.7.2/3rdParty/Boost/include/boost-1_57 \
   C:/opencv/build/include

LIBS += -L/C:/opencv/build/x86/vc12/lib \
   -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_features2d -lopencv_ml \
   -lboost_thread-mt -lboost_system-mt

LIBS += -L/C:/Program Files (x86)/PCL 1.7.2/3rdParty/Boost/lib \
   -lboost_thread-mt -lboost_system-mt

}

I am really new to this and I am sure it is syntactically incorrect, but should be something similar to this. Anybody could give me some hints or help would be much appreciated!

What is $$PWD and -L for example?

The error after running make:

cd tests\test_galif\ && ( if not exist Makefile C:\Qt\Qt5.5.1\5.5\msvc2013\bin\q make.exe C:\Users\Concordia\Documents\OpenSSE\opensse-master\tests\test_galif\te st_galif.pro -o Makefile ) && make -f Makefile make[1]: Entering directory C:/Users/Concordia/Documents/OpenSSE/opensse-master /tests/test_galif' make -f Makefile.Release make[2]: Entering directoryC:/Users/Concordia/Documents/OpenSSE/opensse-master /tests/test_galif' Makefile.Release:106: * missing separator. Stop. make[2]: Leaving directory C:/Users/Concordia/Documents/OpenSSE/opensse-master/ tests/test_galif' make[1]: *** [release] Error 2 make[1]: Leaving directoryC:/Users/Concordia/Documents/OpenSSE/opensse-master/ tests/test_galif' make: * [sub-tests-test_galif-make_first] Error 2

Upvotes: 2

Views: 1192

Answers (1)

Orest Hera
Orest Hera

Reputation: 6776

In cmd Windows console the tool make should not be found:

'make' is not recognized as an internal or external command, operable program or batch file.

If make is found it comes from some foreign installation (maybe from Cygwin). qmake from msvc2013 Qt installation by default should generate Makefiles for Visual Studio nmake.

The build from console should be started from appropriate command prompt that has proper build environment (%PATH% variable). For 32 bit compilation it should be x86 command prompt:

Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x86 Native Tools Command Prompt

From that console it should be possible to run nmake and appropriate compiler.

It should help with the Makefile error. It is possible that there are some other compiler or linker errors, but they will be revealed only with correct build environment by suitable make tool.


In general if some error is reported due to Makefile format on some line (for example Makefile.Release:106) it may be needed to check why there is something wrong in that line.


The headers path with spaces must be quoted for proper compilation:

INCLUDEPATH += "C:/Program Files (x86)/PCL 1.7.2/3rdParty/Boost/include/boost-1_57"

The libraries paths for the linker can be set by -L followed by path. The path with spaces must be quoted for proper linkage:

LIBS += -L"C:/Program Files (x86)/PCL 1.7.2/3rdParty/Boost/lib"

For completeness note that it possible to have other troubles with paths with spaces using older Qt versions QMAKE adding extra quotations in lib path of make file However, Qt5.5.1 is not affected by that issue.

Upvotes: 1

Related Questions