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
Solved

unresolved external symbol CdbLastOLEError::GetDescription() VC8

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 854
FMX TCameraComponent Problem 2 84
What is atomic operation? 6 65
Precision Problem in C++ 7 44
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

860 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