Dave's Brain

Browse - 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()

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.