December 22, 2011

SirSmackalot SirSmackalot
Lab Rat
2 posts

qmake INCLUDEPATH problem

 

Hi,

i am working with Qt on Windows 7. I have a build.bat where all necessary steps are called (qmake, nmake,…).
In the build.bat i set a path to the include-directory of the JDK:

set JDK=“C:\\Program Files\\Java\\jdk1.7.0_02”
(in the batch file there is only one backslash as seperator, i dont know why this editor puts in two”

in my .pro-file i want to pass this path to INCLUDEPATH with:

INCLUDEPATH += $$(JDK)/include

and:

INCLUDEPATH += $$(JDK)/include/win32

I additionaly use Visual Studio 2010. Opening the pro-File creates a Project, but the include path are wrong. It only shows:

“/include/win32”. The string behind $$(JDK) is gone. I tried everything i could think of till now:

t = $$quote($$quote($$replace(jdk, \\\\, /)/include/win32))
#message($$t)
INCLUDEPATH += $$t

but this does not work either. The strange thing is, messaging $$t in this case shows:

“C:/Program Files/Java/jdk1.7.0_02”/include/win32
(I cannot get rid of the spaces in this string)

i even tried to $$replace the quotations, but that did not work.
Any suggestions would be very appreciated!

Thanks,

SirSmackalot

4 replies

December 22, 2011

sierdzio sierdzio
Area 51 Engineer
2544 posts

It might be different on windows (I doubt it), but on GNU/Linux, variables are denoted with $${}, not $$() for example:

  1. INCLUDEPATH += $${JDK}/include

 Signature 

(Z(:^

December 22, 2011

Volker Volker
Robot Herder
5428 posts

And as you have spaces in the path, you need to put the result between quotes:

  1. INCLUDEPATH += "$${JDK}/include"
  2. INCLUDEPATH += "$${JDK}/include/win32"

December 22, 2011

SirSmackalot SirSmackalot
Lab Rat
2 posts

The qmake-docs say round brackets are right. “{” don`t work for me here.
That does not work. In VS the resulting path is still just “/include” and “/include/win32”.
The funny thing is that message($$INCLUDEPATH) reports this:
C:\Program Files\Java\jdk1.7.0_02/include

In VS the first part of the string is gone. Weird. Replacing the “\” with “/” does not change a thing.

Thanks, but seems like a bug to me somewhere.

December 22, 2011

Volker Volker
Robot Herder
5428 posts

ah, correct. Environment vars are accessed with $$(xxx) and qmake variables with $${xxx}.

 
  ‹‹ How to run "Network chat client example" in QT demos ?      How to wait on read and close event simultaneously on QTcpSocket ››

You must log in to post a reply. Not a member yet? Register here!