Solved

unresolved external symbol CLSID_DirectDraw

Posted on 1998-04-23
6
1,292 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

11 Experts available now in Live!

Get 1:1 Help Now