Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

unresolved external symbol CdbLastOLEError::GetDescription() VC8

Posted on 2007-03-22
3
Medium Priority
?
1,025 Views
Last Modified: 2013-11-20
I am migrating from VC6 to VC2005. I can not seem to resolve this linker error in VS2005. It is generated by the GetDescription() object associated with CdbLastOLEError. Code segment and linker error shown below. I'm linking with VC8 versions ddao35d.lib (debug) and ddao35.lib (release). Compiler is set with these flags:

Unsigned Char - Yes (/J)
Treat wchar_t as built-in (/Zc:wchar_t-)

Does anyone know how to resolve this error?
Thanks!
---------------------------------------------------------
.
.
.
catch ( CdbException e )
{

CString strMsg;
CdbLastOLEError exError;

strMsg = exError.GetDescription(); // generates linker error

// Displays error number and description
TRACE( _T("\t CdbLastOLEError.Description: %d - %s\n"),
DBERR(e.m_hr), (LPCTSTR)strMsg);

strMsg.Empty();
}

Linker error
dbthread.obj : error LNK2001: unresolved external symbol "public: class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > __thiscall CdbLastOLEError::GetDescription(void)" (?GetDescription@CdbLastOLEError@@QAE?AV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@XZ)
0
Comment
Question by:VideoFletch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 18771014
>>>> public: class ATL::CStringT<char,class

The char indicates that you are not using UNICODE strings. As far as I know, ATL *only*  can be called with UNICODE strings. If your MFC CStrings were single-byte strings you need to convert to UNICODE strings before calling ATL. Or you try to set the _UNICODE and UNICODE macro in your preprocessor settings, pray, and rebuild all ....

Regards, Alex
0
 
LVL 11

Accepted Solution

by:
alexcohn earned 2000 total points
ID: 18771220
first of all - congrats: you're in a good company, see http://www.thescripts.com/forum/thread263470.html

http://msdn2.microsoft.com/en-us/library/ttc6chk1(VS.80).aspx says:
As of Visual C++ .NET, the Visual C++ environment and wizards no longer support DAO (although the DAO classes are included and you can still use them). Microsoft recommends that you use OLE DB Templates or ODBC for new projects. You should only use DAO in maintaining existing applications.

The DAO MFC libraries, including ddao35d.lib, are part of PlatformSDK and are not compatible with the new MFC. You are expected to #include <afxdao.h> and it will link daouuid.lib.
0
 

Author Comment

by:VideoFletch
ID: 18771784
Thanks!  I should have signed up sooner.  I've spent a week trying to resolve this issue through MSDN and other sites.  Took less than two hours from the experts!

Adding the <afxdao.h> and daouuid.lib was the trick.  PLUS:  changing the declaration of CdbLastOLEError   TO   CDaoErrorInfo.   The CdbLastOLEError is still in <dbdao.h>, but apparently no longer in the ddao35.lib.   Changing to CDaoErrorInfo and linking with the addition of daouuid.lib has corrected the linker error.

New Code looks like this:
-----------------------------------------------
catch ( CdbException e )
{
CString strMsg;
CDaoErrorInfo exError;
strMsg = exError.m_strDescription;    //note change from function call to member

// Displays error number and description
TRACE( _T("\t CDaoErrorInfo.Description: %d - %s\n"),
DBERR(e.m_hr), (LPCTSTR)strMsg);

strMsg.Empty();
}

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question