Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2975 connectés 

  FORUM HardWare.fr
  Programmation
  C++

  Problème de compilation avec la librairie wxWidget

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Problème de compilation avec la librairie wxWidget

n°1121442
sylsau
Posté le 16-06-2005 à 03:21:16  profilanswer
 

Bonjour,
 
A la recherche d'un solution pour faire une interface graphique pour un programme écrit en C++, j'ai trouvé la librairie wxWidget qui a l'avantage de se porter assez facilement sous Windows apparemment.
 
Je suis sur une Debian 3.1 sous linux. J'ai donc téléchargé les packages nécessaires à la librairie wxWidget.
 
J'ai trouvé un petit tutorial sur le site www.wxwidgets.org permettant de faire un petit "Hello World" avec la librairie histoire de voir si j'avais tout bien installé.
 
Le tutorial est à cette adresse :  
 
www.wxwidgets.org/hello.htm
 
 
J'ai donc crée un fichier hworld.cpp comme expliqué dans le tutorial.
Je compile avec la ligne suivante comme expliqué dans le tutorial toujours :  
 


g++ hworld.cpp `wx-config --libs` `wx-config --cxxflags` -o hworld


 
J'obtiens ces erreurs :
 


$ g++ hworld.cpp `wx-config --libs` `wx-config --cxxflags` -o hworld
hworld.cpp:9: error: base class `wxFrame' has incomplete type
hworld.cpp:11: error: erreur d'analyse syntaxique before `&' token
hworld.cpp:13: error: `wxCommandEvent' was not declared in this scope
hworld.cpp:13: error: `event' was not declared in this scope
hworld.cpp:13: error: invalid data member initialization
hworld.cpp:13: error: (use `=' to initialize static data members)
hworld.cpp:13: error: variable or field `OnQuit' declared void
hworld.cpp:14: error: `wxCommandEvent' was not declared in this scope
hworld.cpp:14: error: `event' was not declared in this scope
hworld.cpp:14: error: invalid data member initialization
hworld.cpp:14: error: variable or field `OnAbout' declared void
hworld.cpp:26: error: incomplete type `wxFrame' does not have member `
   sm_eventTable'
hworld.cpp:27: error: `wxCommandEventFunction' was not declared in this scope
hworld.cpp:28: error: `wxCommandEventFunction' was not declared in this scope
hworld.cpp: Dans function « wxApp* wxCreateApp() »:
hworld.cpp:31: error: cannot allocate an object of type `MyApp'
hworld.cpp:31: error:   because the following virtual functions are abstract:
/usr/include/wx/app.h:131: error:       virtual int wxAppBase::OnRun()
hworld.cpp: Dans member function « virtual bool MyApp::OnInit() »:
hworld.cpp:36: error: invalid use of undefined type `struct wxPoint'
/usr/include/wx/utils.h:46: error: forward declaration of `struct wxPoint'
hworld.cpp:36: error: `wxSize' undeclared (first use this function)
hworld.cpp:36: error: (Each undeclared identifier is reported only once for
   each function it appears in.)
hworld.cpp:37: error: `Show' undeclared (first use this function)
hworld.cpp:38: error: `SetTopWindows' undeclared (first use this function)
hworld.cpp: At global scope:
hworld.cpp:42: error: erreur d'analyse syntaxique before `&' token
hworld.cpp:45: error: erreur de syntaxe before `->' token
hworld.cpp:46: error: erreur de syntaxe before `->' token
hworld.cpp:47: error: erreur de syntaxe before `->' token
hworld.cpp:48: error: erreur de syntaxe before `*' token
hworld.cpp:49: error: erreur de syntaxe before `->' token
hworld.cpp:50: error: `menuBar' was not declared in this scope
hworld.cpp:50: error: le C++ ISO interdit la déclaration de « SetMenuBar » sans
   type
hworld.cpp:50: error: `int MyFrame::SetMenuBar' is not a static member of `
   class MyFrame'
hworld.cpp:51: error: le C++ ISO interdit la déclaration de « CreateStatusBar »
   sans type
hworld.cpp:52: error: le C++ ISO interdit la déclaration de « SetStatusText »
   sans type
hworld.cpp:52: error: `int MyFrame::SetStatusText' is not a static member of `
   class MyFrame'
hworld.cpp:52: error: conversion invalide de « const char* » vers « int »
hworld.cpp:53: error: erreur d'analyse syntaxique before `}' token
hworld.cpp:55: error: `wxCommandEvent' was not declared in this scope
hworld.cpp:55: error: erreur d'analyse syntaxique before `)' token
hworld.cpp:56: error: no `void MyFrame::OnQuit(...)' member function declared
   in class `MyFrame'
hworld.cpp:56: error: declaration of `void MyFrame::OnQuit(...)'
hworld.cpp:13: error: conflicts with previous declaration `int MyFrame::OnQuit'
hworld.cpp: Dans member function « void MyFrame::OnQuit(...) »:
hworld.cpp:57: error: `Close' undeclared (first use this function)
hworld.cpp: At global scope:
hworld.cpp:60: error: `wxCommandEvent' was not declared in this scope
hworld.cpp:60: error: erreur d'analyse syntaxique before `)' token
hworld.cpp:61: error: no `void MyFrame::OnAbout(...)' member function declared
   in class `MyFrame'
hworld.cpp:61: error: declaration of `void MyFrame::OnAbout(...)'
hworld.cpp:14: error: conflicts with previous declaration `int MyFrame::OnAbout
   '
hworld.cpp: Dans member function « void MyFrame::OnAbout(...) »:
hworld.cpp:62: error: `wxMessageBox' undeclared (first use this function)
 


 
et voici le contenu de hworld.cpp :
 

Code :
  1. #include "wx/wx.h"
  2. class MyApp: public wxApp
  3. {
  4. virtual bool OnInit();
  5. };
  6. class MyFrame: public wxFrame
  7. {
  8. public:
  9.  MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
  10.  void OnQuit(wxCommandEvent& event);
  11.  void OnAbout(wxCommandEvent& event);
  12.  DECLARE_EVENT_TABLE();
  13. };
  14. enum
  15. {
  16. ID_Quit=1,
  17. ID_About
  18. };
  19. BEGIN_EVENT_TABLE(MyFrame, wxFrame)
  20. EVT_MENU(ID_Quit, MyFrame::OnQuit)
  21. EVT_MENU(ID_About, MyFrame::OnAbout)
  22. END_EVENT_TABLE()
  23. IMPLEMENT_APP(MyApp)
  24. bool MyApp::OnInit()
  25. {
  26. MyFrame *frame = new MyFrame("Hello World",wxPoint(50,50),wxSize(450,340));
  27. frame->Show(TRUE);
  28. SetTopWindows(frame);
  29. return TRUE;
  30. }
  31. MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size): wxFrame((wxFrame *)NULL,-1,title,pos,size)
  32. {
  33. wxMenu *menuFile = new wxMenu;
  34. menuFile->Append(ID_About,"&About..." );
  35. menuFile->AppendSeparator();
  36. menuFile->Append(ID_Quit,"E&xit" );
  37. wxMenuBar *menuBar = new wxMenuBar;
  38. menuBar->Append(menuFile,"&File" );
  39. SetMenuBar(menuBar);
  40. CreateStatusBar();
  41. SetStatusText("Welcome to wxWidgets!" );
  42. }
  43. void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
  44. {
  45. Close(TRUE);
  46. }
  47. void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
  48. {
  49. wxMessageBox("This is a wxWidgets Hello world sample","About Hello world", wxOK | wxICON_INFORMATION, this);
  50. }


 
J'ai du mal installer quelque chose mais je vois pas quoi.
Quelqu'un aurait une idée d'où ça peut venir exactement ?

mood
Publicité
Posté le 16-06-2005 à 03:21:16  profilanswer
 

n°1121470
shikra
life is short,drink faster!!!
Posté le 16-06-2005 à 08:05:12  profilanswer
 

salut a toi  
est ce que tu a ete dans preference et compilateur??
dans les option ya 2 ligne a rajouter.
faut que tu les cherhce je l'ai connai pas desole

n°1121515
sylsau
Posté le 16-06-2005 à 09:18:44  profilanswer
 

C'est à quel endroit qu'il y a cette partie préférences et compilateur ? (j'utilise g++ sous linux)

n°1121530
shikra
life is short,drink faster!!!
Posté le 16-06-2005 à 09:28:36  profilanswer
 

bonne question moi j'utilisais anjuta!!je vais chercher et je te dis quoi

n°1121696
sylsau
Posté le 16-06-2005 à 11:13:56  profilanswer
 

personne d'autre ?

n°1122023
Lam's
Profil: bas.
Posté le 16-06-2005 à 15:05:19  profilanswer
 

Même avec un #include "wx/frame.h" ça marche pas ?
Tu utilises quelle version de wx et de gcc ?

n°1122332
sylsau
Posté le 16-06-2005 à 17:31:55  profilanswer
 

En incluant wx/frame.h, j'ai des erreurs supplémentaires.
J'utilises wx 2.4 et gcc 3.3.5 que j'ai pris en paquet avec apt sur ma debian.


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C++

  Problème de compilation avec la librairie wxWidget

 

Sujets relatifs
Problème Mysql + PhpBB[résolu] Pb d'impression : perte de la mise en page et des couleurs
probleme de header!!!Probleme super etrange de tableaux superposés [resolu]
probleme appel date du jour dans BDDprobleme de dereferencement
Problème INCLUDE + page accueil[assembleur] probleme d'interruption avec 68HC11
Probleme de sessionProblème de variable pour affichage de pages
Plus de sujets relatifs à : Problème de compilation avec la librairie wxWidget


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR