Solved

unresolved external symbol CdbLastOLEError::GetDescription() VC8

Posted on 2007-03-22
3
986 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
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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now