What does this mean?

This is a discussion on What does this mean? within the C++ Programming forums, part of the General Programming Boards category; While trying DirectDraw for the first time, I got the following error: DirectDraw error LNK2019: unresolved external symbol _DirectDrawCreateEx@16 referenced ...

  1. #1
    oswinsutrisno
    Guest

    Question What does this mean?

    While trying DirectDraw for the first time, I got the following error:

    DirectDraw error LNK2019: unresolved external symbol _DirectDrawCreateEx@16 referenced in function "int __cdecl InitDirectDraw(void)" (?InitDirectDraw@@YAHXZ)

    What does this mean?

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    You need to link a lib file.

  3. #3
    oswinsutrisno
    Guest
    Any idea how to do this in VC++ .Net?

    Thanks

  4. #4
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    What DirectX version are you using? I'll assume 9, but the method would be the same (the name would be different) for old versions.

    Essentially, you have 3 options:

    1) Add it into the linker's libraries (under the options menu for the project).

    2) Add the .lib directly to your project just like any other source file.

    3) Put the following into a source (any .h or .cpp file): #pragma comment(lib,"d3d9")

    I personally use #3; it's not portable to all compilers, but it's in the source code itself, which means that you only need to give someone the source for them to know what libraries they need to include.

    Edit: I guess you're not using DirectX 9 (DirectDraw hasn't existed as a standalone since DirextX 7). Nonetheless, the method is the same.
    Last edited by Cat; 06-04-2003 at 10:40 PM.

  5. #5
    oswinsutrisno
    Guest
    actually I am using directx 9.

    I've always wondered what #pragma comment does!

    Thanks alot. =)

  6. #6
    Registered User oswin's Avatar
    Join Date
    Jun 2003
    Posts
    2
    btw, how do I find out the name of the library?

    I mean, the library I want to inlcude is ddraw.lib

    so i would have to include:

    #pragma comment(lib, "ddraw") ?

    Umm I can't explain it well enough, but are is the format:

    #pragma comment(file extension, "name of file")??

    Thanks

  7. #7
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    lib tells it the type of the file, and the string is the filename (without the extention).

    #pragma comment(lib, "ddraw") would tell the linker to search for a file called "ddraw.lib" on any of the default search paths.

  8. #8
    Registered User oswin's Avatar
    Join Date
    Jun 2003
    Posts
    2
    Umm since we're talking about #pragmas

    Whats #pragma once do? VC++ seems to auto generate it in the code alot.

    Thanks Again!

  9. #9
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Anything and everything. #pragma's are compiler dependent things that will do various things. For instance, they can be used to inhibit certain warnings, or many other things.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21