Thread: Linking error with DirectDrawCreateEx

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    50

    Linking error with DirectDrawCreateEx

    hey. I'm back. Where did everyone go? Hopefully there is a few experts left here to help out. It's kind of scarey posting on a board that is so dead.

    I'm getting a linking error when compiling on MSVC 6.0. I am trying to make a Tetris game and am learning how to load bitmaps. This program is supposed to load bitmaps. I added the bitmap to the project but still get the linking error.

    --------------------Configuration: Tetrisbegin - Win32 Debug--------------------
    Linking...
    tetrisbeg.obj : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16
    Debug/Tetrisbegin.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    Tetrisbegin.exe - 2 error(s), 0 warning(s)



    Here is the code at which directdrawcreateEx is called

    Code:
    int Game_Init(void *parms)
    {
    // this function is where you do all the initialization 
    // for your game
    
    // create object and test for error
    if (DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL)!=DD_OK)
       return(0);
    
    // set cooperation level to windowed mode normal
    if (lpdd->SetCooperativeLevel(main_window_handle,
               DDSCL_ALLOWMODEX | DDSCL_FULLSCREEN | 
               DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)!=DD_OK)
        return(0);
    
    // set the display mode
    if (lpdd->SetDisplayMode(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_BPP,0,0)!=DD_OK)
       return(0);
    
    // Create the primary surface
    memset(&ddsd,0,sizeof(ddsd));
    ddsd.dwSize         = sizeof(ddsd);
    ddsd.dwFlags        = DDSD_CAPS;
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
    
    if (lpdd->CreateSurface(&ddsd,&lpddsprimary,NULL)!=DD_OK)
       return(0);
    
    // now load the 16 bit color bitmap
    Load_Bitmap_File(&bitmap16bit, "ANDRE16.BMP");
    
    // return success
    return(1);
    
    } // end Game_Init

    I appreciate any help at all.

    BTW, I didn't write that code. I am not at that stage yet. Just trying understand why it has a problem with directdrawcreateEx. Thanks in advance for replies.

  2. #2
    Registered User
    Join Date
    Mar 2004
    Posts
    50
    huh....I figured it out. I didn't put

    dxguid.lib ddraw.lib dinput.lib

    in the Link part of Project settings. I guess that shows how much of a beginner I am.

    Any further advice is welcome. I am making my first C++ tetris game. I'm going to try not to look at any other tetris games while doing it. Just loading the main bitmap right now. Haven't got to controls or anything like that yet.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    50

    got a new problem

    I've got a new problem now. My bitmap is appearing but its flashing up on the screen so fast that I can't see if it is working correctly or not.

    The instructional cd and book that I'm using had the program make a 640 x 480 bitmap which was full screen.

    My bitmap is 500 x 600 and is not full screen anymore so I've changed everything and now it won't stay on the screen.

    Actually, it was staying on the screen at 640 x 480 but it distorted the hell out of my bitmap so had to change the dimensions of the screen.

  4. #4
    Registered User heat511's Avatar
    Join Date
    Dec 2001
    Posts
    169

    hmmm

    im not a directxer, but im sure posting the entire code would help.
    "uh uh uh, you didn't say the magic word"
    -Jurassic Park

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    50
    For the love of god.

    No one has a piece of C++ code for keeping a damn window on the screen. No one wants to see 150 lines of code. It won't let me post that much on here anyway, I've tried it before.

  6. #6
    Registered User heat511's Avatar
    Join Date
    Dec 2001
    Posts
    169
    Quote Originally Posted by jjj93421
    For the love of god.

    No one has a piece of C++ code for keeping a damn window on the screen. No one wants to see 150 lines of code. It won't let me post that much on here anyway, I've tried it before.
    i just posted a 900 line program... you can. and i for one would love to look at the code.
    "uh uh uh, you didn't say the magic word"
    -Jurassic Park

  7. #7
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Blit the bitmap to the screen using the hardware blitter. I'm not sure what you mean here so some explaining would help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. HELP!!Why and How to solve this linking errors.
    By huwan in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2007, 06:30 AM
  2. Problems linking with g++
    By Just in forum Linux Programming
    Replies: 11
    Last Post: 07-24-2006, 01:35 AM
  3. strange linking error -- can not find shared library
    By George2 in forum C Programming
    Replies: 2
    Last Post: 07-10-2006, 10:51 PM
  4. Replies: 8
    Last Post: 04-27-2006, 10:39 AM
  5. Grrr.... SDL Linking Problem
    By 7EVEN in forum Game Programming
    Replies: 5
    Last Post: 08-12-2005, 08:44 PM