Hi,
i'm using Visual C++, and when i try to add a dialog resource to my plugin (and include afxwin.h) and compile i get the folowing error:
c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Do i have to create a MFC Dll with VS app wizard, and copy the contents of the provided sample source code to my project? I'm not sure if it works.
how do you guys do it to support mfc code?
Thanks in advance,
djorge
Can't add Dialog resource
Moderators: Hacker, petermad, Stefan2, white
You're rigth. I've changed the #include "windows.h" to #incliude "AfxWin.h", but now the complier tells me that there are two DllMain defined:
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in fsplugin.obj
nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in fsplugin.obj; second definition ignored
Debug/fsplugin.wfx : fatal error LNK1169: one or more multiply defined symbols found
How do i solve this problem?
thanks,
djorge
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in fsplugin.obj
nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in fsplugin.obj; second definition ignored
Debug/fsplugin.wfx : fatal error LNK1169: one or more multiply defined symbols found
How do i solve this problem?
thanks,
djorge
you should not have a dllmain entry too. this is done by the afx library.
you need to derive a class from CWinApp and declare an instance of this class.
Preprocessor definition must have WIN32, _DEBUG, _WINDOWS, _WINDLL, _AFXDLL for debug mode
============== sample from dircpy.wcx
CListplugApp theApp("DIRCPY_WCX");
BOOL CListplugApp::InitInstance()
{
BOOL val = CWinApp::InitInstance();
hInst = m_hInstance;
TRACE1("dircpy : InitInstance : %d\n", m_hInstance);
return val;
}
CListplugApp::CListplugApp(LPCTSTR pszAppName) : CWinApp(pszAppName)
{
TRACE0("dircpy : plug-in initialized\n");
}
====== end sample
but try to use the wizard to see the code generated. I think it's the best way to start a dll based on MFC and add your exported function.
FG
you need to derive a class from CWinApp and declare an instance of this class.
Preprocessor definition must have WIN32, _DEBUG, _WINDOWS, _WINDLL, _AFXDLL for debug mode
============== sample from dircpy.wcx
CListplugApp theApp("DIRCPY_WCX");
BOOL CListplugApp::InitInstance()
{
BOOL val = CWinApp::InitInstance();
hInst = m_hInstance;
TRACE1("dircpy : InitInstance : %d\n", m_hInstance);
return val;
}
CListplugApp::CListplugApp(LPCTSTR pszAppName) : CWinApp(pszAppName)
{
TRACE0("dircpy : plug-in initialized\n");
}
====== end sample
but try to use the wizard to see the code generated. I think it's the best way to start a dll based on MFC and add your exported function.
FG