C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compilation avec VisualC++ 6.0

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
news.wanadoo.fr
Guest





PostPosted: Wed Jan 19, 2005 10:18 am    Post subject: Compilation avec VisualC++ 6.0 Reply with quote



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





PostPosted: Wed Jan 19, 2005 10:39 am    Post subject: Re: Compilation avec VisualC++ 6.0 Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.