Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error in oleauto.h

130 views
Skip to first unread message

Roberto Icaza

unread,
May 3, 2001, 7:45:45 PM5/3/01
to
Hi,
I am programming a small and simple Win32 DLL in Visual C++ 6.0 (SP 4)
with the following code:

extern "C" long __stdcall GetList(BSTR *ListHolder)
{
String MYSTRING = "one,two,three,four,five";

ListHolder = SysAllocString(MYSTRING.c_str());
return true;
}

In order to use SysAllocString, I have to include the standard header
file oleauto.h, which I did. However, when trying to build the DLL, I get
two errors from the same line in the header file:

Line:
EXTERN_C const IID IID_StdOle;

Errors:
error C2146: syntax error : missing ';' before identifier 'IID_StdOle'
fatal error C1004: unexpected end of file found

What is wrong? Why am I getting errors in a standard include file? Is
there any other file I should have included? I installed Service Pack 4
thinking there might be a bug, but its not that. I'm no C++ expert, but as
far as I know, its not my code, is it?

Any help very much appreciated,
Roberto Icaza

Randy Charles Morin

unread,
May 6, 2001, 4:15:11 PM5/6/01
to
You have to include wtypes before oleauto.
Also, you have to dereference ListHolder.
The following compiles in VC6.

#include <string>
#include <wtypes.h>
#include <oleauto.h>

extern "C" long __stdcall GetList(BSTR *ListHolder)
{

std::wstring MYSTRING = L"one,two,three,four,five";

*ListHolder = ::SysAllocString(MYSTRING.c_str());
return true;
}

--
Randy Charles Morin
http://www.kbcafe.com/randycharlesmorin

"Roberto Icaza" <ric...@ans.edu.ni> wrote in message
news:uOnVCyC1AHA.1540@tkmsftngp03...

0 new messages