Bonsoir ;je suis débutante en QT et je réalise un projet avec une interface Qt 5.1.0 en utilisant le langage C et la bibliothèque d'opencv .
voila mon code
.pro
le .h
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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 #------------------------------------------------- # # Project created by QtCreator 2015-04-25T17:18:25 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = essai2 TEMPLATE = app CONFIG +=console CONFIG -=app-bundle CONFIG -=qt INCLUDEPATH += C:\OpenCV2.1\include INCLUDEPATH +=C:\OpenCV2.1\include\opencv CONFIG(release,debug|release){ LIBS += C:\OpenCV2.1\lib\cv210 C:\OpenCV2.1\lib\cv210d C:\OpenCV2.1\lib\cvaux210 C:\OpenCV2.1\lib\cvaux210d C:\OpenCV2.1\lib\cxcore210 C:\OpenCV2.1\lib\cxcore210d C:\OpenCV2.1\lib\cxts210 C:\OpenCV2.1\lib\highgui210 C:\OpenCV2.1\lib\highgui210d C:\OpenCV2.1\lib\ml210 C:\OpenCV2.1\lib\ml210d C:\OpenCV2.1\lib\opencv_ffmpeg210 C:\OpenCV2.1\lib\opencv_ffmpeg210d } TARGET = essai TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui
le .cpp
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
20
21
22
23
24 #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_pushButton_clicked(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
le main window.cpp
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
20
21
22
23
24 #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_pushButton_clicked(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
l'or de la compilation de mon de mon projet en Qt j'obtient cette erreur :
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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 #include "mainwindow.h" #include "ui_mainwindow.h" #include <iostream> #include <cv.h> #include <cvaux.h> #include <highgui.h> #include <stdio.h> #include <math.h> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { int nc,nl; IplImage* imgage = cvLoadImage("lect.jpg"); nc=imgage->width; nl=imgage->height; IplImage *image1 = cvCreateImage(cvSize( nc, nl ), 8, 1 ); cvCvtColor( imgage, image1,CV_RGB2GRAY ); // Compute rotation matrix // cvNamedWindow( "Image", CV_WINDOW_AUTOSIZE ); cvShowImage( "Image", imgage ); cvNamedWindow( "Image1", CV_WINDOW_AUTOSIZE ); cvShowImage("Image1", image1); cvWaitKey(0); }
C:\Users\HOME\Documents\essai\main.cpp:1: In file included from ..\essai\main.cpp:1:0:
C:\Users\HOME\Documents\essai\mainwindow.h:3: erreur : QMainWindow: No such file or directory
c quoi le problème et comme je peux le réglé?
et merci .
Partager