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 : #include "wx/wx.h" class MyApp: public wxApp { virtual bool OnInit(); }; class MyFrame: public wxFrame { public: MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); DECLARE_EVENT_TABLE(); }; enum { ID_Quit=1, ID_About }; BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(ID_Quit, MyFrame::OnQuit) EVT_MENU(ID_About, MyFrame::OnAbout) END_EVENT_TABLE() IMPLEMENT_APP(MyApp) bool MyApp::OnInit() { MyFrame *frame = new MyFrame("Hello World",wxPoint(50,50),wxSize(450,340)); frame->Show(TRUE); SetTopWindows(frame); return TRUE; } MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size): wxFrame((wxFrame *)NULL,-1,title,pos,size) { wxMenu *menuFile = new wxMenu; menuFile->Append(ID_About,"&About..."); menuFile->AppendSeparator(); menuFile->Append(ID_Quit,"E&xit"); wxMenuBar *menuBar = new wxMenuBar; menuBar->Append(menuFile,"&File"); SetMenuBar(menuBar); CreateStatusBar(); SetStatusText("Welcome to wxWidgets!"); } void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(TRUE); } void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxMessageBox("This is a wxWidgets Hello world sample","About Hello world", wxOK | wxICON_INFORMATION, this); } J'ai du mal installer quelque chose mais je vois pas quoi. Pourtant quand je fais : $ wx-config --libs -pthread -lwx_base-2.4 $ wx-config --cxxflags -I/usr/lib/wx/include/base-2.4 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES ça point bien au bon endroit je pense. J'ai gcc 3.3.5 et wx 2.4 Si quelqu'un sait ce que j'ai mal fait dans l'installation ou a déjà eu ce même problème, ça serait sympa qu'il m'explique ce qu'il faut faire. Merci d'abord.