Solved

unresolved external symbol CLSID_DirectDraw

Posted on 1998-04-23
6
1,303 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio Exe Issue, 12 32
Visual Fox Pro commands 15 50
how to bring to back always mid parent image form 21 85
Please explain "Multi-Tenant Services" 5 99
This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 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