Board index » cppbuilder » Unresolved external 'CComBSTR::operator =(const char*)'

Unresolved external 'CComBSTR::operator =(const char*)'

I use BCB4 to build DLL.

#include <oleidl.h>
#include <atl/atlbase.h>
void abc()
{
CComBSTR  a1;
a1 = "123";

Quote
}

Complier show error message
[Linker Error]Unresolved external 'CComVariant::operator = (const char*)'
referenced from d:\demo\test.obj

Why?

 

Re:Unresolved external 'CComBSTR::operator =(const char*)'


Quote
: "linkk" <li...@ms1.url.com.tw> wrote:
>CComBSTR  a1;
>a1 = "123";
>}

>Complier show error message
>[Linker Error]Unresolved external 'CComVariant::operator = (const char*)'
>referenced from d:\demo\test.obj

No idea.

I took your code and pasted it into a C++Builder ActiveX DLL. Compiles.

--
Stefan Hoffmeister (TeamB)     http://www.econos.de/
Please do apply judgement when sending email.

Re:Unresolved external 'CComBSTR::operator =(const char*)'


Linkk,

Although named 'Active Template Library', ATL is not completely templatized.
Some of the methods of classes are implemented in a .CPP file to which you
must link - else you'll get unresolved external errors from the linker.

The particular file you need to add to your project is ATLIMPL.CPP
[\BCB\INCLUDE\ATL directory]. You'll notice that several method of CComBSTR
is implemented in this .CPP file.

Regards,

Bruneau.

PS: It's often tricky to pull in ATL headers in a Client project. Often ATL
refers to _Module which is Server specific. This was the main reason why we
opted to not use ATL helpers, such as CComBSTR, in Client applications.
We're still considering this issue, specially given the number of requests
I've seen recently about hiding BSTRs...

Quote
linkk wrote in message <7itb55$d...@forums.borland.com>...
>I use BCB4 to build DLL.

>#include <oleidl.h>
>#include <atl/atlbase.h>
>void abc()
>{
>CComBSTR  a1;
>a1 = "123";
>}

>Complier show error message
>[Linker Error]Unresolved external 'CComVariant::operator = (const char*)'
>referenced from d:\demo\test.obj

>Why?

Other Threads