Solved

unresolved external symbol CdbLastOLEError::GetDescription() VC8

Posted on 2007-03-22
3
1,021 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 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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

630 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