Solved

unresolved external symbol CLSID_DirectDraw

Posted on 1998-04-23
6
1,296 Views
Last Modified: 2013-12-03
Here's the code:

...
<include ddraw.h>
...
void Test()
{
    HRESULT hr;
    HINSTANCE hinst;
    FARPROC dgco;
    IClassFactory*pcf;
   
    hinst=LoadLibrary("ddraw.dll");
    if (hinst) {
   
        dgco=GetProcAddress(hinst,"DllGetClassObject");

        hr=( (HRESULT(WINAPI*)(REFCLSID,REFIID,IClassFactory**)) dgco)
             (CLSID_DirectDraw,
              IID_IClassFactory,
              &pcf);
       
        if (S_OK==hr) {
          AfxMessageBox("OK");
          pcf->Release();
        }

        FreeLibrary(hinst);
    }
}

It compiles OK, but at link time, I get the following error:

error LNK2001: unresolved external symbol _CLSID_DirectDraw

Linking with ddraw.lib does not help.

CLSID_DirectDraw is declared in ddraw.h:

#if defined( _WIN32 ) && !defined( _NO_COM )
DEFINE_GUID( CLSID_DirectDraw,                  0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 );
DEFINE_GUID( CLSID_DirectDrawClipper,           0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 );
DEFINE_GUID( IID_IDirectDraw,                  0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
DEFINE_GUID( IID_IDirectDraw2,                  0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 );
DEFINE_GUID( IID_IDirectDrawSurface,            0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
DEFINE_GUID( IID_IDirectDrawSurface2,            0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 );

DEFINE_GUID( IID_IDirectDrawPalette,            0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
DEFINE_GUID( IID_IDirectDrawClipper,            0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
                 
#endif

Why do I get the unresolved external symbol error ?
0
Comment
Question by:byang
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1397002
Include ddraw.lib into your project
0
 
LVL 23

Expert Comment

by:chensu
ID: 1397003
Since you are linking ddraw.dll dynamically (why do you want to do so?), I think you shouldn't link ddraw.lib.

Either

#define INITGUID
#include <objbase.h>
#include <ddraw.h>

or

#include <objbase.h>
#include <initguid.h>
#include <ddraw.h>

0
 
LVL 3

Author Comment

by:byang
ID: 1397004
galkin: I tried linking with ddraw.lib, and still got the same error. This is mentioned in my question and I'm afraid you missed it.

chensu: I'm experiementing to see if I can manually obtain usable interface pointers thru DllGetClassObject(), without going thru SCM. I think as long as I pay attention to threading models, it should work. I'll try your INITGUID define. Since my test program is MFC, I assume all the necessary headers are included already.

Also, please don't answer this question for now. MS developer support news emailed on April 21 contains this link about unresolved CLSID/IID in internet client SDK, which might answer my question. I'll check it first.

http://support.microsoft.com/support/kb/articles/Q182/1/17.asp
0
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.

 
LVL 23

Expert Comment

by:chensu
ID: 1397005
When #include <initguid.h> is used after #include <objbase.h>, DEFINE_GUID will define the GUID instead of declaring it.

The KB article does not apply to your case.
0
 
LVL 3

Author Comment

by:byang
ID: 1397006
You're right, DEFINE_GUID has 2 expansions, depending on if INITGUID is defined.

Answer the question and I'll accept it.
0
 
LVL 23

Accepted Solution

by:
chensu earned 70 total points
ID: 1397007
Thank you.
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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

920 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

14 Experts available now in Live!

Get 1:1 Help Now