Oct 18th, 2002, 05:38 AM
#1
Thread Starter
Fanatic Member
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
Oct 18th, 2002, 07:28 AM
#2
Frenzied Member
#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.
Oct 18th, 2002, 09:56 AM
#3
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.
Oct 18th, 2002, 11:25 AM
#4
Thread Starter
Fanatic Member
I've installed the DirectX8 SDK, and I've added the DDRAW.lib to the workspace...
Oct 18th, 2002, 11:36 AM
#5
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.
Oct 18th, 2002, 11:42 AM
#6
Thread Starter
Fanatic Member
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
Oct 18th, 2002, 11:52 AM
#7
Thread Starter
Fanatic Member
HELP!
I don't have the "C:\mssdk\include\" directory!!!
Oct 18th, 2002, 12:11 PM
#8
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.
Oct 18th, 2002, 12:14 PM
#9
Thread Starter
Fanatic Member
I've installed it into C:\mssdk\, and i have files there, but no Include directory.
Oct 18th, 2002, 01:53 PM
#10
Thread Starter
Fanatic Member
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)
Oct 18th, 2002, 02:19 PM
#11
Frenzied Member
You have to add ddraw.lib to your import library list in the project settings.
Z.
Oct 18th, 2002, 02:41 PM
#12
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.
Oct 18th, 2002, 03:42 PM
#13
Thread Starter
Fanatic Member
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)
Oct 18th, 2002, 03:43 PM
#14
Thread Starter
Fanatic Member
Sorry, two errors
Oct 18th, 2002, 04:33 PM
#15
Frenzied Member
Try ddraw7.lib. Just guessing here =).
Z.
Oct 18th, 2002, 04:33 PM
#16
Thread Starter
Fanatic Member
Attached Files
Oct 18th, 2002, 04:38 PM
#17
Thread Starter
Fanatic Member
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."
Oct 18th, 2002, 04:45 PM
#18
Thread Starter
Fanatic Member
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...
Oct 19th, 2002, 08:23 AM
#19
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.
Oct 19th, 2002, 08:43 AM
#20
Monday Morning Lunatic
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
Oct 19th, 2002, 10:17 AM
#21
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.
Oct 19th, 2002, 02:00 PM
#22
Monday Morning Lunatic
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
Forum Rules
Click Here to Expand Forum to Full Width