bonjour
je suis débutant en ++ et j'essaye de créer un petit programme tout simple qui émet la note la pour accorder un guitare.
mais quand je compile il me met sa :
C:\prog\acorder guitare\fenetre.cpp|3|error: `fenetre' has not been declared|
C:\prog\acorder guitare\fenetre.cpp|3|error: ISO C++ forbids declaration of `fenetre' with no type|
C:\prog\acorder guitare\fenetre.cpp||In function `int fenetre()'
C:\prog\acorder guitare\fenetre.cpp|3|error: only constructors take base initializers|
C:\prog\acorder guitare\fenetre.cpp|5|error: `setFixedSize' was not declared in this scope|
C:\prog\acorder guitare\fenetre.cpp|9|error: `m_boutonPlay' was not declared in this scope|
C:\prog\acorder guitare\fenetre.cpp|9|error: invalid use of `this' in non-member function|
C:\prog\acorder guitare\fenetre.cpp|13|error: `m_boutonStop' was not declared in this scope|
C:\prog\acorder guitare\fenetre.cpp|13|error: invalid use of `this' in non-member function|
C:\prog\acorder guitare\fenetre.cpp|5|warning: unused variable 'setFixedSize'|
C:\prog\acorder guitare\main.cpp||In function `int main(int, char**)'
C:\prog\acorder guitare\main.cpp|8|error: expected `;' before "fenetrePrincipale"|
C:\prog\sdl\acorder guitare\main.cpp|8|warning: statement is a reference, not call, to function `fenetre'|
C:\prog\acorder guitare\main.cpp|8|warning: statement has no effect|
C:\prog\acorder guitare\main.cpp|9|error: `fenetrePrincipale' was not declared in this scope|
C:\prog\acorder guitare\main.cpp|12|error: invalid conversion from `int (*)()' to `int'|
C:\prog\acorder guitare\main.cpp|9|warning: unused variable 'fenetrePrincipale'|
||=== Build finished: 11 errors, 4 warnings ===|
et le code source :
- main.cpp :
#include "fenetre.cpp"
int main(int argc, char* argv[])
{
QApplication app( argc, argv);
fenetre fenetrePrincipale;
fenetrePrincipale.show;
return app.exec;
}
//////////////////////////////////////////////////
-fenetre .cpp :
#include "fenetre.h"
fenetre :: fenetre() : QWidget()
{
setFixedSize(400,100);
QFont policeBouton("arial", 15);
m_boutonPlay = new QPushButton("Accorder",this);
m_boutonPlay -> SetFont(policeBouton);
m_boutonPlay -> move(10,10);
m_boutonStop = new QPushButton("Stop", this);
m_boutonStop -> SetFont(policeBouton);
m_boutonStop -> move(50,10);
}
///////////////////////////////////////////////
-fenetre.h :
#ifndef DEF_FENETRE
#define DEF_FENETRE
#include <QtGui>
#include "fenetre.cpp"
class fenetreublic QWidget
{
public :
fenetre();
private :
QPushButton *m_boutonPlay;
QPushButton *m_boutonStop;
};
#endif
-----