1>d:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h(24) : fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]我的工程是基于ATL, 在创建的时候没有选中支持MFC编译的时候就会出现这个问题
1>d:\program files\microsoft visual studio 8\vc\atlmfc\include\afxv_w32.h(16) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
把#include<afxmt.h>放到stdafx.h这个文件中
AfxOleInit();//初始化OLE/COM库环境(MFC自带的) 这两句话缺一不可,不然会有运行期错误 程序运行结束后记住::CoUninitialize(); //关闭OLE/COM库环境,释放资源link: http://blog.csdn.net/pzhuyy/archive/2007/05/16/1611488.aspx
然后我在工程属性中将Use MFC改为Use MFC in shared DLL
然后在stdafx.h的#pragma once后加入
#include <afxwin.h>
但是会出现
1>mfcs80ud.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in tryATL517.obj
错误
这是为什么
加入了
::CoInitialize(NULL);
AfxOleInit();