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.