Bonsoir,
Depuis cette après-midi je cherche à installer QT4 avec Dev C++ et je n'y arrive pas du tout.
J'installe dev c++ avec mingw puis QT4 en lui précisant lors de l'installation le répertoire où se trouve Dev C++ (C:\Dev-Cpp).
J'insere un template comme celui-ci dans C:\Dev-Cpp\Templates

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
[Template]
ver=1
Name=Qt
Icon=Qt.ico
Description=Create a GUI using the Qt library.
Catagory=GUI
 
[Unit0]
CppName=main.cpp
Cpp=qt_cpp.txt
 
[Project]
UnitCount=1
Type=1
IsCpp=1
CppCompiler=-O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:\Qt\4.3.2\include\QtGui\" -I"C:\Qt\4.3.2\include\QtCore\" -I"C:\Qt\4.3.2\include\" -I"." -I"C:\Qt\4.3.2\include\ActiveQt\" -I"tmp\moc\release_shared" -I"." -I"C:\Qt\4.3.2\mkspecs\win32-g++\"
Linker=-mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows -L"C:\Qt\4.3.2\lib\" -L"C:\Qt\4.3.2\lib\" -lmingw32 -lqtmain -lQtCore4 -lQtGui4
ProjectIcon=Qt.ico
Ensuite je précise dans Dev C++ dans les options de compilateur->répetoires
C:\QT\4.3.2\bin

Quand je cré un projet GUI , mon hello world ne fonctionne pas.

Voici les erreurs:

Invalid argument
Invalid argument
In function `int main(int, char**)':
`QApplication' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
expected `;' before "app"
`QPushButton' undeclared (first use this function)
expected `;' before "hello"
`hello' undeclared (first use this function)
`app' undeclared (first use this function)
[Build Error] [main.o] Error 1

Et voici le programme:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
#include <QApplication>
#include <QPushButton>
 
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
 
    QPushButton hello("Hello world!");
    hello.resize(100, 30);
 
    hello.show();
    return app.exec();
}
Si vous avez déjà eu ce type de problème merci de m'en faire part.

Bonne soirée