View Single Post
Old 12-07-2009, 03:42 AM   #1
TrippHop
Lurker
 
Join Date: Dec 2009
Posts: 5
Exclamation [QuickFix/Guide] Compiling on Visual Studio C++ 2008

Step #1: Fixing the resource files:
Inside the win32 folder there are a couple resource files.
Open up JK2cgame.rc, JK2game.rc, and ui.rc with a text editor and change all instances of "afxres.h" to "winresrc.h"

Quote:
inside you will find
Code:
#include "afxres.h"
change to:
Code:
#include "winresrc.h"
also change:
Code:
"#include ""afxres.h""\r\n"
to:
Code:
"#include ""winresrc.h""\r\n"
Step #2: Fixing the powf function conflict
Find all the instances of powf and rename it to Q_powf.
( you will find it once in q_shared.h and q_math.c, twice in cg_view.c )

You may choose to use Visual Studio's provided powf function, which yields better results ingame imo, but it may mess up third person aim.

Step #3: Fixing botlib

Find this function in l_precomp.cpp
Code:
int PC_ExpandBuiltinDefine(source_t *source, token_t *deftoken, define_t *define, token_t **firsttoken, token_t **lasttoken)
and just underneath where it says:
Code:
unsigned long t;	//	time_t t; //to prevent LCC warning
change it to:
Code:
time_t;
then look for this in the switch() in the same function:
( this will appear twice, once under case BUILTIN_DATE, and case BUILTIN_TIME )
Code:
curtime = ctime((const long *)&t);
and change it to:
Code:
curtime = ctime(&t);
Step #4: Disable warnings
(optional)
paste this into disablewarnings.h after the #ifdef _WIN32

Code:
//for VS2008
#pragma warning(disable : 4005)		// macro redefinition
#pragma warning(disable : 4996)		// This function or variable may be unsafe...
#pragma warning(disable : 4204)		// nonstandard extension used : non-constant aggregate initializer
#pragma warning(disable : 4431)		// missing type specifier - int assumed. Note: C no longer supports default-int
now you are all ready to make your mod.
but i would pay a visit to this thread first:
http://www.lucasforums.com/showthread.php?t=140104

if anyone would like to contribute on how to setup the debugger that would be great.

I will add a guide later for compiling on linux when i get to it.
TrippHop is offline   you may: quote & reply,