Seite 1 von 1

Compiler findet .h Dateien nicht

Verfasst: 11. Juli 2006 14:33
von baloo der baer
Hallo ich habe folgendes Problem:

ich will das 1. SQL Beispiel von Trolltech(Chachedtable) compilieren aber es kommt folgende Fehlermeldung.


In file included from main.cpp:5:
connection.h:5:24: QSqlDatabase: No such file or directory
connection.h:6:21: QSqlError: No such file or directory
connection.h:7:21: QSqlQuery: No such file or directory
In file included from main.cpp:5:
connection.h: In function `bool createConnection()':
connection.h:19: error: `QSqlDatabase' undeclared (first use this function)
connection.h:19: error: (Each undeclared identifier is reported only once for each function it appears in.)
connection.h:19: error: expected `;' before "db"
connection.h:20: error: `db' undeclared (first use this function)
connection.h:32: error: `QSqlQuery' undeclared (first use this function)
connection.h:32: error: expected `;' before "query"
connection.h:33: error: `query' undeclared (first use this function)
mingw32-make.exe[1]: *** [release\main.o] Error 1
mingw32-make.exe[1]: Leaving directory `C:/Programme/eclipse_old/Workspace/dbzugriff'
C:\MinGW\bin\mingw32-make.exe: *** [release-all] Error 2



Vorher hab ich natürlich

qmake -project
qmake

in die Konsole eingegeben.

Da das erste include (#include <QMessageBox>) gefunden wird aber alles was mit SQL zu tun hat nicht, vermute ich das ich das noch in irgedeine Systemvariable eintragen muß aber in welche?
Ich habe fogende Systemvariablen angelegt/erweitert:

PATH:
C:\Qt\4.1.4\bin;C:\MinGW\bin;C:\Qt\4.1.4;
C:\Qt\4.1.4\include;C:\Qt\4.1.4\include\QtSql;C:\Qt\4.1.4\lib

LIB:
C:\Qt\4.1.4\lib

INCLUDE:
C:\Qt\4.1.4\include

QTDIR:
C:\Qt\4.1.4

QMAKESPEC:
win32-g++


Welche Systemvariable brauche ich noch oder liegt der Fehler ganz wo anders?

Danke schon mal jetzt für eure Antworten.
Baloo

Verfasst: 11. Juli 2006 15:30
von Christian81
CONFIG += sql in der pro-Datei fehlt (mal wieder)

Verfasst: 11. Juli 2006 15:44
von baloo der baer
Danke das fehlte wirklich aber wenn ich jetzt nochmal

qmake
make

ausführe kommt die selbe Fehlermeldung.

Meine .pro sieht jetzt so aus:



TEMPLATE = app
TARGET +=
DEPENDPATH += .
INCLUDEPATH += .

# Input
HEADERS += connection.h tableeditor.h
SOURCES += main.cpp tableeditor.cpp

CONFIG += sql

Verfasst: 11. Juli 2006 15:52
von Christian81
Schau ob im Makefile auch wirklich der Pfad zu qt-4-src/include/QtSql drin ist. Ausserdem sollte bei den libs QtSql(d).lib dabei sein.

Deine pro-Datei würde ich ausserdem etwas anpassen. Ein target definieren und HEADERS/SORUCES += durch HEADERS = ersetzen. Nur damit es aufgeräumter aussieht.

Wenn der Pfad nicht drin ist, lösche das Makefile mal und führe nochmals qmake aus.

Verfasst: 11. Juli 2006 16:03
von baloo der baer

Code: Alles auswählen

Schau ob im Makefile auch wirklich der Pfad zu qt-4-src/include/QtSql drin ist. Ausserdem sollte bei den libs QtSql(d).lib dabei sein.
Ist beides nicht drin. Wo muß das genau hin? Muß ich das jetzt jedesmal von Hand ändern?

PS: Danke für die schnellen Antworten.

Verfasst: 11. Juli 2006 16:05
von baloo der baer
Hier nochmal mein make file:

first: release
install: release-install
uninstall: release-uninstall
MAKEFILE = Makefile
QMAKE = qmake
DEL_FILE = del
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
COPY = copy /y
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
INSTALL_FILE = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
DEL_FILE = del
SYMLINK =
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
SUBTARGETS = \
release \
debug

release: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_default: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_first: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release first
release-all: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release all
release-clean: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release clean
release-distclean: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release distclean
release-install: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release install
release-uninstall: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release uninstall
debug: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-make_default: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-make_first: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug first
debug-all: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug all
debug-clean: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug clean
debug-distclean: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug distclean
debug-install: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug install
debug-uninstall: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug uninstall

Makefile: dbzugriff.pro ..\..\..\..\Qt\4.1.4\mkspecs\win32-g++\qmake.conf C:/Qt/4.1.4/mkspecs/qconfig.pri \
..\..\..\..\Qt\4.1.4\mkspecs\features\qt_config.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\exclusive_builds.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\default_pre.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\default_pre.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\release.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\debug_and_release.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\default_post.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\rtti.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\exceptions.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\stl.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\shared.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\warn_on.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\qt.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\thread.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\moc.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\windows.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\resources.prf \
..\..\..\..\Qt\4.1.4\mkspecs\features\uic.prf \
c:\Qt\4.1.4\lib\qtmain.prl
$(QMAKE) -win32 -o Makefile dbzugriff.pro
C:/Qt/4.1.4/mkspecs/qconfig.pri:
..\..\..\..\Qt\4.1.4\mkspecs\features\qt_config.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\exclusive_builds.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\default_pre.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\default_pre.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\release.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\debug_and_release.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\default_post.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\rtti.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\exceptions.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\stl.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\shared.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\warn_on.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\qt.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\thread.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\moc.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\win32\windows.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\resources.prf:
..\..\..\..\Qt\4.1.4\mkspecs\features\uic.prf:
c:\Qt\4.1.4\lib\qtmain.prl:
qmake: qmake_all FORCE
@$(QMAKE) -win32 -o Makefile dbzugriff.pro

qmake_all: FORCE

make_default: release-make_default debug-make_default FORCE
make_first: release-make_first debug-make_first FORCE
all: release-all debug-all FORCE
clean: release-clean debug-clean FORCE
distclean: release-distclean debug-distclean FORCE
-$(DEL_FILE) Makefile

release-mocclean: $(MAKEFILE).Release
$(MAKE) -f $(MAKEFILE).Release mocclean
debug-mocclean: $(MAKEFILE).Debug
$(MAKE) -f $(MAKEFILE).Debug mocclean
mocclean: release-mocclean debug-mocclean

release-mocables: $(MAKEFILE).Release
$(MAKE) -f $(MAKEFILE).Release mocables
debug-mocables: $(MAKEFILE).Debug
$(MAKE) -f $(MAKEFILE).Debug mocables
mocables: release-mocables debug-mocables
FORCE:

$(MAKEFILE).Release: Makefile
$(MAKEFILE).Debug: Makefile

Verfasst: 11. Juli 2006 16:10
von Christian81
Manchmal sollte man mich einfach nur treten *grml*
Aber du hast den Link auch nicht gelesen ;)

nicht "CONFIG += sql" sondern "QT += sql"

Verfasst: 11. Juli 2006 16:18
von baloo der baer
Asche auf mein Haupt. Das das ein Link ist hab ich total übersehen.

Danke! Jetzt läufts.