Nick_72
asked on
Newbie question!
I'm trying to write a dll, but I didn't get far until I ran into an annyoing problem.
I want to use the CCriticalSection class, and according to the msdn I have to include
afxmt.h. However, that gives me the following error:
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
I tried to place afxmt.h over stdafx.h, and that gave another error (or errors):
error C2065: 'CCriticalSection' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'ccs'
error C2065: 'ccs' : undeclared identifier
What is going on?? I've pasted the code below.
#include "stdafx.h"
#include "afxmt.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
CCriticalSection ccs;
return TRUE;
}
Thanks in advance.
/Nick
I want to use the CCriticalSection class, and according to the msdn I have to include
afxmt.h. However, that gives me the following error:
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
I tried to place afxmt.h over stdafx.h, and that gave another error (or errors):
error C2065: 'CCriticalSection' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'ccs'
error C2065: 'ccs' : undeclared identifier
What is going on?? I've pasted the code below.
#include "stdafx.h"
#include "afxmt.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
CCriticalSection ccs;
return TRUE;
}
Thanks in advance.
/Nick
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I used the third option: MFC extension DLL (Using Shared MFC DLL), not knowing really why. What is the main difference between the three of them?