hi
i want to create my own class and use it in another project. I'm following a Tutorial but i'm blocked now. Look what the tuto did
First he made a project FenPrincipale
header
#ifndef FENPRINCIPALE_H
#define FENPRINCIPALE_H
#include <QtGui>
#include <QMainWindow>
{
public:
FenPrincipale();
private:
};
#endif // FENPRINCIPALE_H
#ifndef FENPRINCIPALE_H
#define FENPRINCIPALE_H
#include <QtGui>
#include <QMainWindow>
class FenPrincipale : public QMainWindow
{
public:
FenPrincipale();
private:
};
#endif // FENPRINCIPALE_H
To copy to clipboard, switch view to plain text mode
main
#include <QApplication>
#include <QtGui>
#include <QMainWindow>
#include “FenPrincipale.hâ€
int main(int argc, char *argv[])
{
FenPrincipale fenetre;
fenetre.show();
return app.exec();
}
#include <QApplication>
#include <QtGui>
#include <QMainWindow>
#include “FenPrincipale.hâ€
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
FenPrincipale fenetre;
fenetre.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
.cpp
#include “FenPrincipale.hâ€
FenPrincipale::FenPrincipale()
{
}
#include “FenPrincipale.hâ€
FenPrincipale::FenPrincipale()
{
}
To copy to clipboard, switch view to plain text mode
it works fine for me, but later in the tuto he make a second project
with the following main
#include <QApplication>
#include <QtGui>
#include “FenPrincipale.hâ€
FenPrincipale::FenPrincipale()
{
vue->setModel(modele);
layout->addWidget(vue);
setLayout(layout);
}
#include <QApplication>
#include <QtGui>
#include “FenPrincipale.hâ€
FenPrincipale::FenPrincipale()
{
QVBoxLayout *layout = new QVBoxLayout;
QDirModel *modele = new QDirModel;
QTreeView *vue = new QTreeView;
vue->setModel(modele);
layout->addWidget(vue);
setLayout(layout);
}
To copy to clipboard, switch view to plain text mode
i don't know what he did exactly he wasn't clear he just dropped that code but what i did is
i made new project and paste FenPrincipale.h in the same folder with the new project but this is what i got
C:\Qt\Qt5.0.1\5.0.1\mingw47_32\lib\libqtmaind.a(qt main_win.o):-1: In function `WinMain@16’:
Q:\qt5_workdir\w\s\qtbase\src\winmain\qtmain_win.c pp:131: erreur : undefined reference to `qMain(int, char**)’
collect2.exe:-1: erreur : error: ld returned 1 exit status
Bookmarks