You are not logged in.

1

Wednesday, August 3rd 2005, 2:39pm

[QT4] Makefile

Hello!
I'm have a problem: I writed a simple application. There are:
form/test.ui
include/mainwin.h
include/testdialog.h
src/mainwin.cpp
src/testdialog.cpp
mainwin.pro

mainwin.pro listing:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
unix{
    UI_DIR      = .ui
    MOC_DIR     = .moc
    OBJECTS_DIR = .obj
}

TEMPLATE        = app
TARGET          = test

INCLUDEPATH     +=  include

FORMS           =   form/test.ui

HEADERS         =   include/mainwin.h \
                    include/testdialog.h

SOURCES         =   src/mainwin.cpp \
                    src/testdialog.cpp


I do:
$QT4/bin/qmake
make
And see this:

Source code

1
2
3
4
5
6
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_CORE_LIB -DQT_GUI_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.0.0/mkspecs/default -I. -I/usr/local/Trolltech/Qt-4.0.0/include/QtGui -I/usr/local/Trolltech/Qt-4.0.0/include/QtCore -I/usr/local/Trolltech/Qt-4.0.0/include -Iinclude -I.moc -I.ui -o .obj/mainwin.o src/mainwin.cpp
In file included from src/mainwin.cpp:7:
include/testdialog.h:1:21: ui_test.h: No such file or directory
In file included from src/mainwin.cpp:7:
include/testdialog.h:9: error: syntax error before `::' token
make: *** [.obj/mainwin.o] Error 1

(ui_test.h: No such file or directory)
Ok.

If I move testdialog.h from ./include/ to ./ (and edit mainwin.pro HEADERS from include/testdialog.h to testdialog.h) compiling is Ok!

Is this bug?
How to compile program in first?

PS in attachment work and not worked versions

Thx
IPFreely has attached the following file:
  • test.tar.gz (1.51 kB - 19 times downloaded - latest: Feb 5th 2011, 4:45pm)

2

Wednesday, August 3rd 2005, 3:00pm

when generating Makefile (qmake mainwin.pro) worked version Makefile have generation ui_test.h, but not_worked version Makefile dont have generation ui_test.h
Worked Makefile:

Source code

1
2
3
4
5
...
.obj/mainwin.o: src/mainwin.cpp testdialog.h \
                .ui/ui_test.h
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/mainwin.o src/mainwin.cpp
...


Not Worked Makefile:

Source code

1
2
3
4
...
.obj/mainwin.o: src/mainwin.cpp testdialog.h \
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/mainwin.o src/mainwin.cpp
...

3

Wednesday, August 3rd 2005, 9:41pm

Quoted

How to compile program in first?

I think that Qt did not install properly. I suggest you to go to the folder where Qt examples are stored. There is a Makefile for each example. You can open it with Notepad and compare to you own Makefile to see what is wrong. If you just want to run the program, swap makefiles and replace names of files with own.

jacek

Master

  • "jacek" is male

Posts: 2,729

Location: Warsaw, Poland

  • Send private message

4

Wednesday, August 3rd 2005, 10:16pm

Unfortunately the same problem occurs on my system and both versions of the .pro file look OK to me, so it's probably a qmake bug.

5

Thursday, August 4th 2005, 5:43am

Ha! LOL!
In first(not worked example) I create link ./include/testdialog.h->./testdialog.h and compiling is Ok!