Programming Tips - Why do I get "_dllmain@12 already defined" when I try to link my program?

Date: 2009dec21 Language: C/C++ Framework: MFC Q. Why do I get "_dllmain@12 already defined" when I try to link my program? A. This happens when your program has a DllMain() function and you are trying to link with MFC (in Visual C++). If your program is non-MFC you have accidentally included MFC. Remove (or comment out) all MFC related includes in stdafx.h. Remove any thing like: AFX_MANAGE_STATE(AfxGetStaticModuleState()); If your program is MFC you need to remove your DllMain() Initialize in CMyApp::InitInstance()