 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
news.wanadoo.fr Guest
|
Posted: Wed Jan 19, 2005 10:18 am Post subject: Compilation avec VisualC++ 6.0 |
|
|
Bonjour,
Je travaille sous windows XP avec Visualc++ 6.0 .
Lorsque je compile mon programme, il n'y a aucune erreur et aucun warning.
Par contre, lorsque j'effectue build graphique.exe j'obtient le message
d'erreur suivant:
msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
Debug/graphique.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
graphique.exe - 2 error(s), 0 warning(s)
Ce n'est pas la première fois que je rencontre ce problème. C'est le cas
avec d'autres projets aussi.
Voici le programme avec lequel le problème est rencontré actuellement:
#include <afxwin.h>
//
// Classe Fenetre
//
class Fenetre : public CFrameWnd
{
public:
Fenetre();
};
//
// Classe Fenetre : Implementation
//
Fenetre::Fenetre()
{
Create (NULL,"Titre de la fenêtre");
}
//
// La classe Application
//
class Application : public CWinApp
{
public:
BOOL InitInstance();
};
//
// La classe Application : implementation
//
BOOL Application::InitInstance()
{
m_pMainWnd=new Fenetre();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return true;
}
//
// Objet Global remplacant le main()
//
Application TheApp;
Merci pour votre aide.
Loïc Heckel
|
|
| Back to top |
|
 |
Aurélien REGAT-BARREL Guest
|
Posted: Wed Jan 19, 2005 10:39 am Post subject: Re: Compilation avec VisualC++ 6.0 |
|
|
| Quote: | Par contre, lorsque j'effectue build graphique.exe j'obtient le message
d'erreur suivant:
msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
Debug/graphique.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
graphique.exe - 2 error(s), 0 warning(s)
|
Ce n'est pas du C++ standard donc mauvais forum (spécifique Windows et même
VC++ MFC).
Mais bon : la solution est simple : tu as créé un projet console et il
attend main() comme poitn d'entrée. Or tu fais des MFC, donc une appli Win32
GUI et c'est WinMain le point d'entrée dans ce cas (WinMain et caché en
interne dans les MFC). Crée un nouveau projet MFC cette fois-ci.
--
Aurélien REGAT-BARREL
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|