If this is your first visit, be sure to
check out the
FAQ
by clicking the
link above. You may have to
register
or
Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
I am following this step in order to provide MFC Support in my ATL COM DLL
http://support.microsoft.com/kb/173974
But When in include these files
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation extensions
in Stdafx.h, then I come across this error
1>d:\Maverick\Projects\CCPM\SRC\WTL80\include\atlctrls.h(1995) : error C3861: 'ImageList_Read': identifier not found
1>d:\Maverick\Projects\CCPM\SRC\WTL80\include\atlctrls.h(2102) : error C3861: 'ImageList_Read': identifier not found
1>d:\Maverick\Projects\CCPM\SRC\WTL80\include\atlctrls.h(2108) : error C3861: 'ImageList_Write': identifier not found
This is an ATL COM Office Addin and I have to implement print preview functionality for it.
Since this is print preview uses MFC Functions so it cannot be directly implemented in an ATL COM Office Addin.
So I guess I might need support for CView and other classes derived from it like CScrollView, so that I can override OnDraw function for the print content and other CView functions for implementing the Preview.
So should I
1) directly implement a CView with my ATL COM Project or
2) Create an MFC Extension DLL that will do this print and preview work?
After doing some experimentation, that link was helpful in getting the things done, in the end the compiler is generating some errors
1>Project_Native.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowInvalidArgException(void)" (?AfxThrowInvalidArgException@@YGXXZ)
1>UndoBox.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowInvalidArgException(void)" (?AfxThrowInvalidArgException@@YGXXZ)
1>AddIn.obj : error LNK2019: unresolved external symbol "void __stdcall AfxThrowInvalidArgException(void)" (?AfxThrowInvalidArgException@@YGXXZ) referenced in function "int __cdecl AfxCrtErrorCheck(int)" (?AfxCrtErrorCheck@@YAHH@Z)
1>Connect.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowInvalidArgException(void)" (?AfxThrowInvalidArgException@@YGXXZ)
1>FilterBox.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowInvalidArgException(void)" (?AfxThrowInvalidArgException@@YGXXZ)
1>Plug_In.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowInvalidArgException(void)" (?AfxThrowInvalidArgException@@YGXXZ)
1>UndoBox.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ)
1>Plug_In.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ)
1>Project.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ)
1>Project_Native.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ)
1>Trial.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ)
1>AddIn.obj : error LNK2019: unresolved external symbol "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ) referenced in function "int __cdecl AfxCrtErrorCheck(int)" (?AfxCrtErrorCheck@@YAHH@Z)
1>Application.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ)
1>Connect.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ)
1>FilterBox.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowMemoryException(void)" (?AfxThrowMemoryException@@YGXXZ)
1>Project.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowOleException(long)" (?AfxThrowOleException@@YGXJ@Z)
1>Project_Native.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowOleException(long)" (?AfxThrowOleException@@YGXJ@Z)
1>Trial.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowOleException(long)" (?AfxThrowOleException@@YGXJ@Z)
1>UndoBox.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowOleException(long)" (?AfxThrowOleException@@YGXJ@Z)
1>Application.obj : error LNK2019: unresolved external symbol "void __stdcall AfxThrowOleException(long)" (?AfxThrowOleException@@YGXJ@Z) referenced in function "void __stdcall ATL::AtlThrowImpl(long)" (?AtlThrowImpl@ATL@@YGXJ@Z)
1>Connect.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowOleException(long)" (?AfxThrowOleException@@YGXJ@Z)
1>FilterBox.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowOleException(long)" (?AfxThrowOleException@@YGXJ@Z)
1>Plug_In.obj : error LNK2001: unresolved external symbol "void __stdcall AfxThrowOleException(long)" (?AfxThrowOleException@@YGXJ@Z)
1>Connect.obj : error LNK2019: unresolved external symbol "public: void __thiscall CException::Delete(void)" (?Delete@CException@@QAEXXZ) referenced in function __catch$?CreateInstance@?$CComCreator@V?$CComObjectCached@VCComClassFactory@ATL@@@ATL@@@ATL@@SGJPAXABU_GUID@@PAPAX@Z$0
1>FilterBox.obj : error LNK2001: unresolved external symbol "public: void __thiscall CException::Delete(void)" (?Delete@CException@@QAEXXZ)
1>Plug_In.obj : error LNK2001: unresolved external symbol "public: void __thiscall CException::Delete(void)" (?Delete@CException@@QAEXXZ)
1>UndoBox.obj : error LNK2001: unresolved external symbol "public: void __thiscall CException::Delete(void)" (?Delete@CException@@QAEXXZ)
1>InputBox.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::~CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(void)" (__imp_??1?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@XZ) referenced in function "public: void __thiscall CCPM::Dialogs::CInputBox::UpdateList(void)" (?UpdateList@CInputBox@Dialogs@CCPM@@QAEXXZ)
1>Project_Interface_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::~CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(void)" (__imp_??1?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@XZ)
1>Project_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::~CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(void)" (__imp_??1?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@XZ)
1>Utils.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::~CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(void)" (__imp_??1?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@XZ)
1>InputBox.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: wchar_t * __thiscall ATL::CSimpleStringT<wchar_t,1>::GetBuffer(void)" (__imp_?GetBuffer@?$CSimpleStringT@_W$00@ATL@@QAEPA_WXZ) referenced in function "public: void __thiscall CCPM::Dialogs::CInputBox::UpdateList(void)" (?UpdateList@CInputBox@Dialogs@CCPM@@QAEXXZ)
1>Project_Interface_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: wchar_t * __thiscall ATL::CSimpleStringT<wchar_t,1>::GetBuffer(void)" (__imp_?GetBuffer@?$CSimpleStringT@_W$00@ATL@@QAEPA_WXZ)
1>Project_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: wchar_t * __thiscall ATL::CSimpleStringT<wchar_t,1>::GetBuffer(void)" (__imp_?GetBuffer@?$CSimpleStringT@_W$00@ATL@@QAEPA_WXZ)
1>Utils.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: wchar_t * __thiscall ATL::CSimpleStringT<wchar_t,1>::GetBuffer(void)" (__imp_?GetBuffer@?$CSimpleStringT@_W$00@ATL@@QAEPA_WXZ)
1>InputBox.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > const &)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@ABV01@@Z) referenced in function "public: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall ATL::COleDateTime::Format(unsigned long,unsigned long)const " (?Format@COleDateTime@ATL@@QBE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@2@KK@Z)
1>Project_Interface_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > const &)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@ABV01@@Z)
1>Project_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > const &)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@ABV01@@Z)
1>Utils.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > const &)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@ABV01@@Z)
1>InputBox.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::LoadStringW(unsigned int)" (__imp_?LoadStringW@?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAEHI@Z) referenced in function "public: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall ATL::COleDateTime::Format(unsigned long,unsigned long)const " (?Format@COleDateTime@ATL@@QBE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@2@KK@Z)
1>Project_Interface_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::LoadStringW(unsigned int)" (__imp_?LoadStringW@?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAEHI@Z)
1>Project_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::LoadStringW(unsigned int)" (__imp_?LoadStringW@?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAEHI@Z)
1>Utils.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::LoadStringW(unsigned int)" (__imp_?LoadStringW@?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAEHI@Z)
1>InputBox.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(void)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@XZ) referenced in function "public: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall ATL::COleDateTime::Format(unsigned long,unsigned long)const " (?Format@COleDateTime@ATL@@QBE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@2@KK@Z)
1>Project_Interface_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(void)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@XZ)
1>Project_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(void)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@XZ)
1>Utils.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(void)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@XZ)
1>InputBox.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(wchar_t const *)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@PB_W@Z) referenced in function "public: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall ATL::COleDateTime::Format(unsigned long,unsigned long)const " (?Format@COleDateTime@ATL@@QBE?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@2@KK@Z)
1>Project_Interface_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(wchar_t const *)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@PB_W@Z)
1>Project_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(wchar_t const *)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@PB_W@Z)
1>Utils.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >(wchar_t const *)" (__imp_??0?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@QAE@PB_W@Z)
1>Project_Interface_Reports.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CSimpleStringT<wchar_t,1>::operator wchar_t const *(void)const " (__imp_??B?$CSimpleStringT@_W$00@ATL@@QBEPB_WXZ) referenced in function "public: virtual void __thiscall CCPM::CProject::ProjectIncursionReport(struct CCPM::Reports::ProjectData &,class std::vector<struct CCPM::Reports::BufferIncursionData *,class std::allocator<struct CCPM::Reports::BufferIncursionData *> > &)" (?ProjectIncursionReport@CProject@CCPM@@UAEXAAUProjectData@Reports@2@AAV?$vector@PAUBufferIncursionData@Reports@CCPM@@V?$allocator@PAUBufferIncursionData@Reports@CCPM@@@std@@@std@@@Z)
1>Project_Reports.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ATL::CSimpleStringT<wchar_t,1>::operator wchar_t const *(void)const " (__imp_??B?$CSimpleStringT@_W$00@ATL@@QBEPB_WXZ)
Can someone tell me the reason for these errors??
If you are creating an ATL app as a DLL, then this is what your stdafx.h should look like...
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once
#ifndef STRICT
#define STRICT
#endif
#include "targetver.h"
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#include <afxwin.h>
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdisp.h> // MFC Automation classes
#endif // _AFX_NO_OLE_SUPPORT
#include "resource.h"
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
using namespace ATL;
So, create a test ATL project with MFC support and you will find <afxwin.h> and <afxdisp.h> included and if you remove MFC support from the wizard, these are not included. That should get u started...
Also, when you right click on your project name in the solution explorer and go to the properties, and then navigate to the left side tree view's Configuration Properties -> General node....then on the right side you will see an option "Use of MFC". Make sure that is set to "Use MFC in a shared dll" other wise, even if you include those MFC includes in stdafx.h, compiler will not build against them.
I hope that should be it...and that is if you are using VS 2008 (9.0)...but VS 2005 is not a lot different as far as VC++ IDE is concerned
Regards,
Bhushan
#define WIN32_LEAN_AND_MEAN
#ifndef WINVER //Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0400 //Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT //Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 //Change this to the appropriate value to target Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS //Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 //Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE //Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0400 //Change this to the appropriate value to target IE 5.0 or later.
#endif
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS //some CString constructors will be explicit
#define _ATL_ALL_WARNINGS //turns off ATL's hiding of some common and often safely ignored warning messages
#include <objidl.h> // include objidl.h for __IStream_INTERFACE_DEFINED__
#undef _WINDOWS_ // Add this line to prevent MFC from complaining about windows.h included already
#include <afxwin.h>
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#endif // _AFX_NO_OLE_SUPPORT
#include "resource.h"
#include <atlbase.h>
#include <atlcom.h>
#define _WTL_NO_AUTOMATIC_NAMESPACE // Add this line so you won't get ambiguous symbol errors..
#include <atlapp.h>
#include <atlwin.h>
#include <atlmisc.h>
#include <atlframe.h>
#include <atlctrls.h>
#include <atldlgs.h>
#include <atlctrlw.h>
using namespace ATL;
I am working on an old ATL COM MS Office Addin. Most of the things have already been done, there are numerous property sheets and other controls used. I want to add MFC Support for Printing and Print Previewing.
All the controls being used are a part of MFC as well as ATL. They are defined in
#include<afxwin.h> as well as #include <atlctrls.h>
However their implelentation slightly is different in both the files. Previously all these controls (example CEdit, CStatic etc) were mapped with #include <atlctrls.h> and now with MFC Support they started getting mapped with <afxwin.h> instead of <atlctrls.h>.
Due to this different implementation it started throwing errors. I resolved the ambuguity errors by making slight modification. For example Previously it was..
CEdit m_ctlUsedDuration;I changed it to
WTL::CEdit m_ctlUsedDuration;
Now the compiler is able to recognize that these classes belong to ATL not MFC, however it has spawn to some new errors which I mentioned in this orignal thread.
Yes I changed the setting to USE MFC AS Shared DLL. But those external unresolved errors are still there, in debug mode. When I change the active configuration to "release", the unresolved errors doesn't exist but is one error stating
1>uafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in AddIn.obj
1> Creating library Release/CCPM.lib and object Release/CCPM.exp
1>Release/CCPM.dll : fatal error LNK1169: one or more multiply defined symbols found
Can you help me with this??
Yes I changed the setting to USE MFC AS Shared DLL. But those external unresolved errors are still there, in debug mode. When I change the active configuration to "release", the unresolved errors doesn't exist but is one error stating
1>uafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in AddIn.obj
1> Creating library Release/CCPM.lib and object Release/CCPM.exp
1>Release/CCPM.dll : fatal error LNK1169: one or more multiply defined symbols found
Can you help me with this??
http://support.microsoft.com/kb/148652
- ?
Hey...just try out the stdafx.h file code that I have posted. The targetver.h might contain all the WINVER stuff u r including there...not sure though. It seems that u r unnecessarily defining and undefining windows stuff. Just try removing the windows specific stuff and just keep ATL and MFC stuff and see what happens. Also, try to find out the docs and context of the errors you are getting. Just type in the error number in google and u might get enough to play around.
#pragma once
#ifndef STRICT
#define STRICT
#endif
/* comment the following out...
#define WIN32_LEAN_AND_MEAN
#ifndef WINVER //Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0400 //Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT //Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 //Change this to the appropriate value to target Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS //Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 //Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE //Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0400 //Change this to the appropriate value to target IE 5.0 or later.
#endif
End commented part
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS //some CString constructors will be explicit
#define _ATL_ALL_WARNINGS //turns off ATL's hiding of some common and often safely ignored warning messages
#include <objidl.h> // include objidl.h for __IStream_INTERFACE_DEFINED__
#undef _WINDOWS_ // Add this line to prevent MFC from complaining about windows.h included already
#include <afxwin.h>
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxext.h> // MFC extensions...not sure if you need this
#include <afxdisp.h> // MFC Automation classes
#endif // _AFX_NO_OLE_SUPPORT
#include "resource.h"
#include <atlbase.h>
#include <atlcom.h>
#define _WTL_NO_AUTOMATIC_NAMESPACE // Add this line so you won't get ambiguous symbol errors..
#include <atlapp.h>
#include <atlwin.h>
#include <atlmisc.h>
#include <atlframe.h>
#include <atlctrls.h>
#include <atldlgs.h>
#include <atlctrlw.h>
using namespace ATL;
I am not sure...but as I said, please find out what link errors u r getting and owing to what part of the code. Then find out the required includes and so on...that ofcourse, if it does not work. Also, check the path of the includes in the VC project settings...and check the linker tab for any non standard linker options.
Other than that I can only guess
Bhushan