Solved

unresolved external symbol CLSID_DirectDraw

Posted on 1998-04-23
6
1,309 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
[X]
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
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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