Dave's Brain

Browse - programming tips - dllmain already defined

Date: 2009dec21
Language: C/C++

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()
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2010, 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.