Bonjour, je suis en train d'essayer de creer un thread interface utilisateur. Pour ce faire, je procede comme definit dans la doc de visual c++ mais lors de la compilation toujour la meme erreur:
"nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/essai.exe : fatal error LNK1120: 2 unresolved externals"
pourriez vous m'aidez aussi rapidement que vous pourrez??
voici mes source:
MAIN:
#include "stdafx.h"
#include <Afxwin.h>
#include <iostream.h>
#include <windows.h>
#include <stddef.h>
#include <stdlib.h>
#include <conio.h>
#include "essai.h"
void main(void)
{
CWinThread* pThread = AfxBeginThread(RUNTIME_CLASS(MyThread));
while (1)
{Sleep(500);
printf("%s\n","prog principal");}
}
/////////////////////////////////////////////////////////////////////
ESSAI.H:
#include "stdafx.h"
#include <afxwin.h>
#include <iostream.h>
#include <windows.h>
#include <process.h>
#include <stddef.h>
#include <stdlib.h>
#include <conio.h>
class MyThread : public CWinThread
{
DECLARE_DYNCREATE(MyThread)
protected:
MyThread(); // protected constructor used by dynamic creation
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBounceThread)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~MyThread();
// Generated message map functions
//{{AFX_MSG(CBounceThread)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
////////////
IMPLEMENT_DYNCREATE(MyThread, CWinThread)
MyThread::MyThread()
{
}
MyThread::~MyThread()
{
}
int MyThread::InitInstance()
{ int i=0;
//return CWinThread::InitInstance();
for (i=0;i<=10;i++) { printf("%s","thread en cours"); }
return i;
}
BEGIN_MESSAGE_MAP(MyThread, CWinThread)
//{{AFX_MSG_MAP(CBounceThread)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()