DDraw Help

Started by
5 comments, last by Alpha_ProgDes 17 years, 12 months ago
I am trying to start learning direct draw, and I am coming across these errors and do not know how to fix them. ------ Build started: Project: T3D Game Shell, Configuration: Debug Win32 ------ Compiling... main.cpp .\main.cpp(192) : error C2062: type 'void' unexpected .\main.cpp(193) : error C2143: syntax error : missing ';' before '{' Build log was saved at "file://c:\Documents and Settings\Owner\Desktop\Programming\Windows Game Programming Book\Chapter 4\T3D Game Shell\T3D Game Shell\Debug\BuildLog.htm" T3D Game Shell - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== here is my code

int Game_Init(HWND hwnd)
{
	// this is called once after the window is created, and before the main loop

	LPDIRECTDRAW7 lpdd7 = NULL; // direct draw 7 interface

	if (FAILED(DirectDrawCreateEx(NULL,(**void)&lpdd7, IID_IDirectDraw7, NULL))) // line 192 ****************
	{
		//error
	}// end if

	// set cooperation level
	if (FAILED(lpdd7->SetCooperativeLevel(hwnd,DDSCL_NORMAL | DDSCL_FULLSCREEN)))
	{
		//error
	}// end if

	// return success or failure
	return(1);

}// end game init

Advertisement
here's a link that will help most of your initialization problems.
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/ddraw7/directdraw7/ddtut_0tkn.asp

Beginner in Game Development?  Read here. And read here.

 

(**void)
should probably be
(void**)
now i get this :x

------ Build started: Project: T3D Game Shell, Configuration: Debug Win32 ------
Compiling...
main.cpp
Linking...
main.obj : error LNK2019: unresolved external symbol _DirectDrawCreateEx@16 referenced in function "int __cdecl Game_Init(struct HWND__ *)" (?Game_Init@@YAHPAUHWND__@@@Z)
main.obj : error LNK2019: unresolved external symbol _IID_IDirectDraw7 referenced in function "int __cdecl Game_Init(struct HWND__ *)" (?Game_Init@@YAHPAUHWND__@@@Z)
C:\Documents and Settings\Owner\Desktop\Programming\Windows Game Programming Book\Chapter 4\T3D Game Shell\Debug\T3D Game Shell.exe : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Owner\Desktop\Programming\Windows Game Programming Book\Chapter 4\T3D Game Shell\T3D Game Shell\Debug\BuildLog.htm"
T3D Game Shell - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
well did you follow the example in the link or the post bakery2k1 has?

Beginner in Game Development?  Read here. And read here.

 

You need to link to (IIRC) ddraw.lib and dxguid.lib.
Quote:Original post by bakery2k1
You need to link to (IIRC) ddraw.lib and dxguid.lib.

i concur.
fixxer i already gave you directions to add .libs to your project. use them to do the same for your those two .libs [smile]

Beginner in Game Development?  Read here. And read here.

 

This topic is closed to new replies.

Advertisement