Compiling a mod under Windows


(l87) #1

how do you compile under windows?


(Sauron|EFG) #2

Depends on the compiler. If you’re using VC++ there’s a workspace file (wolf.dsw) in the src directory.


(l87) #3

thanks for the reply, i’m using dev c++ … dunno if that’s ok? sorry i’m new to this whole “programming” scene :wink:

also, shouldn’t there be bat files in the source code? sorry for all the questions. :confused:


(RR2DO2) #4

Visual studio 6 and .NET (2002) project files have been supplied with the source and will work fine. Other compilers/environments have not been tried or tested.


(l87) #5

alright, thanks for all the answers everyone.


(nUllSkillZ) #6

I’ve been testing dev-c++ Version 4 (actually only the ui_mp_x86 project so far).
But I’ve got 2 errors compiling the “q_math.c”.
These errors appear before __inline … and __asm … .


(Balr14) #7

I don’t think it’s compatable with version 4.


(Ramoonus) #8

beta 5 of dev-c++???
im going to test it … in a sec


(Ragnar_40k) #9

I have Visual studio 6 w/o .NET (my version is from 1998) and I am able to compile everything w/o an error.


(dcoshea) #10

Dev-C++ is just an IDE (editor which lets you run a compiler) rather than a compiler itself; the full installer does come with a compiler, and the version of the compiler you’re using is more significant than the version of Dev-C++. It looks like Dev-C++ 5.0 beta 8 comes with GCC 3.2 for MingW.

You might want to look at the Borland C++BuilderX Personal version. It comes with both a GCC for MingW plus Borland’s own compiler. Borland’s compiler might be more likely to understand the source code than GCC since the source probably uses some Microsoft-specific extensions to the C language. Also, no insult intended to Dev-C++, but the Borland IDE is probably more powerful. You should take note of the license agreement with C++BuilderX though since it might prevent you from distributing the mod for free (not likely) or selling it (likely). Go to http://www.borland.com/products/downloads/download_cbuilderx.html to get it.

I’d give compiling with C++BuilderX a go myself but I don’t have time right now, sorry!

Regards,
David


(Ramoonus) #11

the borland compiler isnt easier (i cant get it working)
the builder: ill have a look at it then


(SCDS_reyalP) #12

I remember there being trouble compiling RTCW with the borland compiler. Seaching google might show you how other people got around those problems. In general, borland C dislikes many things that msvc doesn’t care about.


(dcoshea) #13

Bummer, I was hoping that the “Microsoft Visual C++ Compatability” option ("-VM") would help.

Regards,
David


(shaunf) #14

Never mind, I just realised what I was doing.


(dcoshea) #15

I seem to have gotten the three DLLs compiling under Borland C++BuilderX Personal with the Borland compilers. I took the following steps:

  • set up a project for each of the 3 DLLs
  • added the .c files listed in the .dsp (Microsoft Visual C++ project files) files in each directory to the projects (apart from files marked as “PROP Exclude_From_Build 1”), plus the .def file
  • added “__declspec(dllexport)” before the vmMain and dllEntry functions in the three _main.c and _syscalls.c files
  • in the Build Options Explorer, select the compiler stage (i.e. click on the “BCC32” row) and in the Options tab, in the “Other options and parameters” group, ticked “Do not prefix underbars to exported symbol names (-vu)” and in the “Paths and Defines” tab I entered the defines I found in the .dsp file PLUS I added C_ONLY since I was having trouble getting the assembler code to compile AND I had to define GAMEDLL=1 instead of just GAMEDLL for the qagame DLL since Microsoft’s pre-processor seems a bit more lenient in its processing than Borlands’
  • I had to make some basic changes to the code, including changing the initialiser for a data structure to not contain variable data (I replaced the variable data with NULLs and then added statements below that to initialize the values) and in a few cases I had to replace typecasts of floats to booleans with comparisons of floats against 0 since the Borland compiler doesn’t seem to want to do the typecast

I did all this for a debug build and the game seems to run okay; not that I’ve ever played it that much, but I was able to connect to a server (I didn’t try a PunkBuster one since I assume PB will check for modified DLLs) and play a bit so I assume the modified DLLs were working.

I’ll try and put together a patch plus the required project files for the IDE. I can be nagged at (my user name on these forums)@hotmail.com if I forget!

Regards,
David


(dcoshea) #16

If I provide a patch, will everyone know how to apply it or should I provide a pointer to where you can get a patch program? (I’m thinking DJGPP)

Regards,
David


(SCDS_reyalP) #17

I suggest you at least give people a URL. Many would be modders are new to coding, and might not be aware of the use of patch and diffs.

Here is a page for such things http://unxutils.sourceforge.net/

Cygwin is also a (rather bloated) option. http://www.cygwin.com/


(The Fang) #18

i always get an error when i compile the file:

Error executing c:\windows\system32\cmd.exe.

cgame_mp_x86.dll - 1 error(s), 0 warning(s)
The following environment variables were not found
$(WOLFDIR)

can someone give me help?
i already made the environment variable in windows, is there something wrong with?


(Lanz) #19

Do a compile once more and you dont get that error.

But what I did was that I opened the .dsp files in each of the source folders and commented out this line:
PostBuild_Cmds=copy “…\Debug\cgame_mp_x86.dll” “$(WOLFDIR)\etmain”

Problem solved. The compiler creates the dll’s straight in my mod folder anyway.


(The Fang) #20

and then?
there are 0 errors, but i cant find the file anywhere^^
<- bit nooby :wink:
im not sure it is saved anyways…