PDA

View Full Version : qmake doesn't like image files starting with "r"



Pepe
4th April 2007, 02:38
Qt 4.2.3 Windows open source edition.

In my *.pro file I have something like this:

IMAGES = icons/icon1.png \
icons/resize.png \
....

Well, make fails with a "missing separator" error. This is because qmake created a wrong Makefile.Release.

In the Makefile.Release, instead of icons\resize.png appears:
icons
esize.png

It seems that the "\r" characters in "icons\resize" is interpreted as a line break.

This problem happens too with filenames starting with "t" and "n" (\t \n).

So I can't have any files starting with "r", "t" or "n" in the IMAGES section of the pro file.

I tried writing it "icons\resize.png", "icons//resize.png", "icons\\resize.png", nothing... the same result.

Is this a bug or am I doing something wrong?

(This problem doesn't occur in linux)

magland
4th April 2007, 03:28
I believe that "IMAGES" is not a qmake variable for qt4.
Use RESOURCES instead.

For example,
RESOURCES += myresources.qrc
and then in myresources.qrc you could have something like


<RCC>
<qresource prefix="/" >
<file>icons/icon1.png</file>
<file>icons/resize.png</file>
</qresource>
</RCC>

Pepe
4th April 2007, 12:44
Yes, but I'm developing a Qt 3 program which I need to compilable with Qt 4 too.

So I need to use IMAGES.

magland
4th April 2007, 13:50
You can split into two cases using something like:



QT_VERSION=$$[QT_VERSION]
contains( QT_VERSION, "^4.*" ) {
RESOURCES += ...
}
else {
IMAGES += ...
}

wysota
4th April 2007, 14:04
Use forward slashes (/) instead of backward slashes (\) as path separators, for instance "images/resize.png".

Pepe
4th April 2007, 16:21
Actually I already use forward slashes (/) for paths (the program is developed in linux) but qmake converts them to "\" when creates the makefile.

qmake in linux (using the same version, 4.2.3) works perfectly. It seems to be a bug in the windows version of qmake.

wysota
4th April 2007, 21:04
Does qmake from Qt3 convert slashes to backslashes as well?

Pepe
4th April 2007, 23:16
I don't have Qt 3 in Windows.

In Linux, of course, it does not.

wysota
5th April 2007, 00:03
So if you don't compile with Qt3 under Windows, maybe you could simply wrap your IMAGES variable into a scope that Windows will ignore?

unix {
IMAGES += ...
}