Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

'WinMain' has not been declared

2 réponses
Avatar
tsalm
Bonjour,

Lorsque je compile ce code, mon compilateur (MinGW) me retourne entre
autre l'erreur ;
`WinMain' has not been declared

Voici mon header :
/* ---------- CODE -------------*/
#ifndef WINMAIN_H
#define WINMAIN_H


#include "Configure.h"


#ifdef __DEBUG__
#include <iostream>
#endif

#include <Windows.h>
#include <Winuser.h>

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#ifdef WIN32
#include <Fl/x.H>
#endif

#include "classPrototypes.h"

#include "ListFrame.h"


namespace WinList
{

class WinMain : public Fl_Double_Window
{
public:
ListFrame* listFrame ;

private:
int handle(int);
#ifdef WIN32
HWND hwd_win32;
#endif

public:
WinMain( int w , int h ) ;
~WinMain(void);
void show();
};
}

#endif
/* ------- END CODE -----------------*/

Et ma partie définition :
/* ---------- CODE ---------- */
#include "WinMain.h"

using namespace WinList;

WinMain::WinMain(int w , int h) : Fl_Double_Window(w,h)
{
// Add widgets
begin() ;
this->listFrame = new ListFrame( 0, 0, this->w(), this->h() )
;
end() ;

resizable( (Fl_Widget*) listFrame );

}
/*------- END CODE ------------*/

D'avance merci pour votre aide,
TSalm

2 réponses

Avatar
tsalm
> Voici mon header :
/* ---------- CODE -------------*/
#ifndef WINMAIN_H
#define WINMAIN_H


#include "Configure.h"


#ifdef __DEBUG__
#include <iostream>
#endif

#include <Windows.h>
#include <Winuser.h>

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#ifdef WIN32
#include <Fl/x.H>
#endif

#include "classPrototypes.h"

#include "ListFrame.h"


namespace WinList
{

class WinMain : public Fl_Double_Window
{
public:
ListFrame* listFrame ;

private:
int handle(int);
#ifdef WIN32
HWND hwd_win32;
#endif

public:
WinMain( int w , int h ) ;
~WinMain(void);
void show();
};
}

#endif
/* ------- END CODE -----------------*/

Et ma partie définition :
/* ---------- CODE ---------- */
#include "WinMain.h"

using namespace WinList;

WinMain::WinMain(int w , int h) : Fl_Double_Window(w,h)
{
// Add widgets
begin() ;
this->listFrame = new ListFrame( 0, 0, this->w(), this->h() )
;
end() ;

resizable( (Fl_Widget*) listFrame );

}
/*------- END CODE ------------*/




Je viens de trouver.
Si dois bizarrement indiquer le namespace :
WinList::WinMain::WinMain(int w , int h) : Fl_Double_Window(w,h)
{ ... }

Mais pourquoi ne prends t-il pas en compte mon :
using namespace WinList;
?
Avatar
Serge Paccalin
Le samedi 5 septembre 2009 à 23:50:14, a écrit dans
fr.comp.lang.c++ :

using namespace WinList;

WinMain::WinMain(int w , int h) : Fl_Double_Window(w,h)
{
[...]
}




Je viens de trouver.
Si dois bizarrement indiquer le namespace :
WinList::WinMain::WinMain(int w , int h) : Fl_Double_Window(w,h)
{ ... }

Mais pourquoi ne prends t-il pas en compte mon :
using namespace WinList;
?



using, c'est pour les utilisations. Pour les définitions, tu pouvais
rouvrir le namespace :

namespace WinList
{
WinMain::WinMain(int w , int h) : Fl_Double_Window(w,h)
{
...
}

}

--
___________
_/ _ _`_`_`_) Serge PACCALIN -- sp ad mailclub.net
_L_) Il faut donc que les hommes commencent
-'(__) par n'être pas fanatiques pour mériter
_/___(_) la tolérance. -- Voltaire, 1763