Advertisement

Help w/ Tricks of Windows source code.

Started by August 10, 2002 09:46 PM
5 comments, last by DrunkenBastard 22 years, 6 months ago
I just got Tricks of the Windows Game Programming Gurus 2nd edition yesterday and I have read to the first example freakout(p. 34). I am getting some errors when I try to compile the source. The only post I found on this was over a year old and didn''t have a solution so anyway. I have included the search paths to directX and also included all the DX files it told me to in my project. I have also copied his blackbox.h and blackbox.cpp to my project directory. I am stuck and would appreciate any help. Here is the code I copied from the book:

// Includes **************************************************************************************

#define WIN32_LEAN_AND_MEAN // Include all macros
#define INITGUID			// Include all GUIDs

#include <windows.h>		// Include important windows stuff
#include <windowsx.h>
#include <mmsystem.h>

#include <iostream.h>			// Include important C++ stuff
#include <conio.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <math.h>
#include <io.h>
#include <fcntl.h>

#include <ddraw.h>			// Include DirectX stuff
#include "blackbox.h"		// Include game library

// DEFINES **********************************************************************************

//defines for windows
#define WINDOW_CLASS_NAME		"WIN3DCLASS" //class name

#define WINDOW_WIDTH			640
#define WINDOW_HEIGHT			480

//STATES FOR GAME LOOP
#define GAME_STATE_INIT			0
#define GAME_STATE_START_LEVEL	1
#define GAME_STATE_RUN			2
#define GAME_STATE_SHUTDOWN		3
#define GAME_STATE_EXIT			4

//BLOCK DEFINES
#define NUM_BLOCK_ROWS			6
#define NUM_BLOCK_COLUMNS		8

#define BLOCK_WIDTH				64
#define BLOCK_HEIGHT			16
#define BLOCK_ORIGIN_X			8
#define BLOCK_ORIGIN_Y			8
#define BLOCK_X_GAP				80
#define BLOCK_Y_GAP				32

//PADDLE DEFINES
#define PADDLE_START_X			(SCREEN_WIDTH / 2 - 16)
#define PADDLE_START_Y			(SCREEN_HEIGHT - 32);
#define PADDLE_WIDTH			32
#define PADDLE_HEIGHT			8
#define PADDLE_COLOR			191

//BALL DEFINES
#define BALL_START_Y			(SCREEN_HEIGHT / 2)
#define BALL_SIZE				4

int main(){
	return 0;
}
 
This is the error I get.
  
--------------------Configuration: freakout - Win32 Debug--------
Compiling...
freakout.cpp
Linking...
blackbox.obj : error LNK2001: unresolved external symbol "struct HWND__ *  main_window_handle" (?main_window_handle@@3PAUHWND__@@A)
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/freakout.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

freakout.exe - 3 error(s), 0 warning(s)
  
p.s. I also looked around for the books website thinking there would be updated code there, but couldn''t find it. Again any help is greatly appreciated.
Never mind. Im retarded.

** 500 error **
Advertisement
You have to have ur main processor to be WinMain in a windows app, not main. Change that and it should work.

---
My Site
Come join us on IRC in #directxdev @ irc.afternet.org
quote:
Original post by RapidStunna
You have to have ur main processor to be WinMain in a windows app, not main. Change that and it should work.

---
My Site
Come join us on IRC in #directxdev @ irc.afternet.org


Thank you for the reply Rap. I figured that out a few minutes ago though. Im sooo frickin stupid. I think im gonna go jump off a bridge.
Don''t jump, everyone makes mistakes. I''ve made some pretty stupid mistakes too. I even had the ''=='' mistake where I put ''='' instead of the ''=='' and it took me an hour to figure it out. So don''t bother, you will make less mistakes and get better in a few weeks, trust me.

Sand Hawk

----------------
-Earth is 98% full. Please delete anybody you can.


My Site
----------------(Inspired by Pouya)
quote:
Original post by Sand_Hawk
-Earth is 98% full. Please delete anybody you can



you don''t agree with yourself?

Advertisement
Just fo thet parklife j00 iz n0t g0nn4 git too have teh new 31337 quake IM MAKing. I HATE IT WHEN SPIDERS TOUCH

p.s. excuse me english. im from L.A.
**DrunkenBastard puts on a bunny suit and beats you to death with a metal dildo**

This topic is closed to new replies.

Advertisement