Results 1 to 22 of 22

Thread: Direct Draw *RESOLVED

  1. #1

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553

    Direct Draw *RESOLVED

    Hello,
    I'm new to Direct Draw and i want to learn it.
    I have source code to a program, but when i build it, I get errors:

    --------------------Configuration: Direct Draw1 - Win32 Debug--------------------
    Compiling...
    DD1.CPP
    C:\Documents and Settings\Peter Backman\Mina dokument\Programmering\C++\DDraw\Direct Draw1\DD1.CPP(7) : error C2146: syntax error : missing ';' before identifier 'g_pdd'
    C:\Documents and Settings\Peter Backman\Mina dokument\Programmering\C++\DDraw\Direct Draw1\DD1.CPP(7) : error C2501: 'LPDIRECTDRAW7' : missing storage-class or type specifiers
    C:\Documents and Settings\Peter Backman\Mina dokument\Programmering\C++\DDraw\Direct Draw1\DD1.CPP(7) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.

    Direct Draw1.exe - 3 error(s), 0 warning(s)


    By the way, here is the Source:
    #include <afxwin.h>
    #include <ddraw.h>
    #include <ctime>
    #include <cstdlib>

    HRESULT hRet;
    LPDIRECTDRAW7 g_pdd; //The 3 errors is pointing to this.
    LPDIRECTDRAWSURFACE7 g_pddsprimary;
    LPDIRECTDRAWSURFACE7 g_pddsback;
    LPDIRECTDRAWSURFACE7 g_pddsone;
    DDSURFACEDESC2 ddsd;
    DDSCAPS2 ddsc;

    class cDDProg : public CWinApp
    {
    public:
    virtual BOOL InitInstance();
    };

    cDDProg DDProgram;

    class cDDWind : public CFrameWnd
    {
    CStatic* WelcomeStatic;

    public:



    cDDWind();
    };

    BOOL cDDProg::InitInstance()
    {
    m_pMainWnd = new cDDWind();
    m_pMainWnd->ShowWindow(m_nCmdShow);
    m_pMainWnd->UpdateWindow();



    return TRUE;
    }

    cDDWind::cDDWind()
    {


    WelcomeStatic = new CStatic();
    Create(NULL,"Direct Draw Test.",WS_OVERLAPPEDWINDOW,CRect(100,100,500,300));

    WelcomeStatic->Create("Welcome to the Direct Draw test by Peter Backman!",WS_CHILD|WS_VISIBLE,CRect(0,0,400,200),this);


    //Initialize Direct Draw

    hRet = DirectDrawCreateEx(NULL,(void**)&g_pdd,IID_IDirectDraw7,NULL);

    if (hRet != DD_OK)
    MessageBox("DirectDrawEx Failed!","Direct Draw",MB_EXCLAMATION);

    //Now, set the cooperative level

    hRet = g_pdd->SetCooperativeLevel(cDDWind::m_hWnd,DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE);

    if (hRet != DD_OK)
    MessageBox("SetCooperativeLevel Failed","Direct Draw",MB_EXCLAMATION);

    //Set display mode, 640x480 with 16 bit color deepth
    hRet = g_pdd->SetDisplayMode(640,480,16,0,0);

    if (hRet != DD_OK)
    MessageBox("SetDisplayMode Failed!","Direct Draw",MB_EXCLAMATION);

    //Prepare primary surface info

    ZeroMemory(&ddsd,sizeof(ddsd));

    }
    Last edited by petrus; Oct 18th, 2002 at 04:46 PM.
    ICQ: 128716725

  2. #2
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    #include <ddraw.h> is the problem. This will include the version of the ddraw header that comes with MSVC, which is something like DDraw 3 or 4. I believe that you need to find a copy of the DX7 SDK somewhere, and install it to get the headers you need.

    Z.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    And then in the general settings of VC++ you must list the include path of the DX7 SDK BEFORE the path of VC++'s standard includes.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    I've installed the DirectX8 SDK, and I've added the DDRAW.lib to the workspace...
    ICQ: 128716725

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Make sure the library and include paths of the SDK come before the VC++ standard paths.

    VC++6: Tools->Options->Directories
    For both library files and include files your DX SDK directories should be the first listed ones.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    I have 4 items in the list there:

    1. C:\mssdk\include
    2. C:\Program\Microsoft Visual Studio\VC98\INCLUDE
    3. C:\Program\Microsoft Visual Studio\VC98\MFC\INCLUDE
    4. C:\Program\Microsoft Visual Studio\VC98\ATL\INCLUDE
    ICQ: 128716725

  7. #7

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    HELP!
    I don't have the "C:\mssdk\include\" directory!!!
    ICQ: 128716725

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Where did you install the DirectX SDK to?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    I've installed it into C:\mssdk\, and i have files there, but no Include directory.
    ICQ: 128716725

  10. #10

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    Ah, the setup didn't install all the libs and includes, so i copied them by my self to the C:\mssdk\ directory.
    Now, the 3 errors change into another 3 errors:

    --------------------Configuration: Direct Draw1 - Win32 Debug--------------------
    Compiling...
    DD1.CPP
    Linking...
    DD1.OBJ : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16
    DD1.OBJ : error LNK2001: unresolved external symbol _IID_IDirectDraw7
    Debug/Direct Draw1.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.

    Direct Draw1.exe - 3 error(s), 0 warning(s)
    ICQ: 128716725

  11. #11
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    You have to add ddraw.lib to your import library list in the project settings.

    Z.

  12. #12
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    And dxguid.lib
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  13. #13

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    Now I have included ddraw.lib and dxguid.lib, but now I have one error:

    --------------------Configuration: Direct Draw1 - Win32 Debug--------------------
    Compiling...
    DD1.CPP
    Linking...
    DD1.OBJ : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16
    Debug/Direct Draw1.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    Direct Draw1.exe - 2 error(s), 0 warning(s)
    ICQ: 128716725

  14. #14

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    Sorry, two errors
    ICQ: 128716725

  15. #15
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    Try ddraw7.lib. Just guessing here =).

    Z.

  16. #16

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    BTW, here's the source.
    Attached Files Attached Files
    ICQ: 128716725

  17. #17

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    I'm trying to learn Direct Draw out of a book I have.
    Here's a quotation from the book:

    "Often I include all the library files because the compiler will use only what it needs; you will use only ddraw.lib."
    ICQ: 128716725

  18. #18

    Thread Starter
    Fanatic Member petrus's Avatar
    Join Date
    May 2002
    Location
    pBytes[sizeof(pBytes)/2]
    Posts
    553
    OK, thank you guys, when I read that quatation, I started to think if I should add all Librarys.
    Strange that I have to add all librarys to get it work...
    ICQ: 128716725

  19. #19
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    VC++ is strange sometimes.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  20. #20
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Originally posted by CornedBee
    VC++ is strange sometimes.
    Some are stranger I remember when I was using the SGI compiler, I had to include libraries like this:
    Code:
    ${CC} ${CCFLAGS} -o awb.irix6 ${OBJ_FILES} -lutil -lhgrafix -lwkit -lhgrafix -lutil -lX
    Note the doubling up, in the opposite order. Was the only way to fix a load of unresolved symbols.

    Just so you know it ain't just MS
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  21. #21
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594


    That's ridiculous!
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  22. #22
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    That's what I said
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width