View Full Version: Compiling the Source - A Guide for Windows Users

ivan >>Programming >>Compiling the Source - A Guide for Windows Users


<< Prev | Next >>

TheFallenOne222- 04-10-2005
Compiling the Source - A Guide for Windows Users
Many of us around the forums have been having some major troubles compiling the source for IVAN, and it has been hindering our ability to do anything with it. Therefore, I figured I'd write this guide on how to get it to compile in MinGW. Feel free to post a guide as to how to get it up and running in other compilers or operating systems, and I'll add it to the tutorial. First things first - You'll need to get yourself a copy of MinGW. The newest version can be found on this site. Download the newest release candidate. It should be at the top of the page, listed under "Candidate". All you need is the release file, which should be under "MinGW" in that section. No need to worry about the binutils. The newest candidate as of writing this is 3.2.0-rc-3. Choose your installation directory. After you get MinGW installed, go here to download the SDL libraries. Look under the "Development Libraries" section. Under the "Win32" subsection there should be a release listed with "(Mingw32)" beside it in brackets. That is the release you want, so download that. Once you download and unzip the SDL libraries (Unzip them to any directory, you only need to grab one thing out of the library), open up Windows Explorer and go to where you unzipped the SDL libraries. Copy the "lib" and "include" directories to the MinGW32 folder, telling it to overwrite any existing files in that directory. Now you have MinGW32 setup to compile the sourcecode for IVAN. Now, if you don't have it already, go here and download the IVAN source files, ZIP format. Extract them to a directory that is convenient for you. There are two choices at this point - Either you may modify the makefile for IVAN's sourcecode, or you can add the MinGW bin directory to your path. The easier method is probably adding MinGW to your system's path. Feel free to skip to the section that you would rather do. Choice 1 - Modifying the Makefile Now, reopen Windows Explorer and go to the directory where you extracted the IVAN sourcecode. Look for the file "ivanmgw.mak". Rightclick on that file and choose "Edit". At the top of the file, there should be a section like this: # Iter Vehemens ad Necem makefile for MinGW environment # Copyrights (C) Timo Kiviluoto / IvanDev 2002-2004 CC = g++ -o FeLibDIR = FeLib FeLibGCH = #FeLibGCH = ... FeLibOBJ = ... IVANDIR = Main IVANBIN = IVAN.exe Change the "FeLibDIR" and "IVANDIR" entries so that they point to where your sourcecode actually is. So, for example, I have my sourcecode at D:\Programming\IVAN\ivan-0.50, so my entries would look like: FeLibDIR = D:\Programming\IVAN\ivan-0.50\FeLib IVANDIR = D:\Programming\IVAN\ivan-0.50\Main Once you have done that, you're ready to compile. Open up a DOS prompt (Go to your "Run" menu and type "cmd" and then hit Okay) and navigate to where you installed MinGW32. If you have no experience with a DOS prompt, don't worry, I'll explain what I mean. Here's an example... If you installed it at D:\Applications\MinGW, just type this in at the DOS prompt: D: <hit enter> cd \Applications\MinGW <hit enter> The "prompt" left of where you are typing should then change to the directory that are currently in every time you type a command. If not, make sure you entered it correctly. Then, type in: cd bin This will take you to the "bin" subdirectory. From there, type this command in: mingw32-make -f <directory where source is>\ivanmgw.mak So, for example, with my install of the source at D:\Programming\IVAN\ivan-0.50, I would type this: mingw32-make -f D:\Programming\IVAN\ivan-0.50\ivanmgw.mak Let that run, and presto! You should have a compiled copy of your source. It should create an "IVAN.exe" file inside of the BIN subdirectory of your MinGW install. So, for me, it would be at this directory: D:\Applications\MinGW\bin\IVAN.exe Choice 2 - Adding the BIN directory to your path Rightclick on "My Computer" and go to Properties (If you don't have a "My Computer" icon, you can go to the Start Menu --> Control Panel --> System instead - You may have to switch to "Classic View" in the Control Panel before you see "System"). From there, choose the "Advanced" tab, and then click "Environment Variables" at the bottom. At the bottom of the dialog that pops up should be a section labelled "System Variables". Scroll down until you find the "Path" variable and doubleclick on it. Go to the "Variable Value" textbox in the dialog that opens, and, at the beginning of the path, enter this: <MinGW Path>\bin; So, for example, if I had MinGW installed at D:\Applications\MinGW, I would put this at the beginning: D:\Applications\MinGW\bin; Once you have done that, hit "OK" on all of the dialogs you have open. You are now ready to compile IVAN. Open up a DOS prompt (Go to your "Run" menu and type "cmd" and then hit "OK") and navigate to where you extracted the IVAN source. If you have no experience with a DOS prompt, I'll explain what I mean. Here's an example... If you installed it at D:\Programming\IVAN\ivan-0.50, just type this in at the DOS prompt: D: <hit enter> cd \Programming\IVAN\ivan-0.50 <hit enter> The "prompt" left of where you are typing should then change to the directory that are currently in every time you type a command. If not, make sure you entered it correctly. Then, type in: mingw32-make -f ivanmgw.mak Congratulations, that should compile the source for you, and it should come out as "IVAN.exe" inside of your IVAN source directory. Good luck! If any of you have any thoughts or questions on this, or would like a tutorial for another development tool, post here and let me know and I'll try to put something together. As well, if you would like to contribute something, feel free to do so and I will add it to this post. EDIT: Added holybanana's method.

Lege- 04-11-2005

Sticky!

holybanana- 04-11-2005

Thanks for a comprehensive guide. However, IMHO it is easier not to modify our makefile, but instead add your mingw's bin directory to the environment variables, like this You can freely rename or move this top-level directory, provided you update your system's path environment variable (on Windows 2000, right-click My Computer --> Properties --> Advanced --> Environment Variables). For our example, we'd insert: C:\mingw\bin, preferrably at the beginning of the path. See the install instructions with MinGW for more. from http://www.spacejack.org/games/mingw/ This is the same as adding a path to autoexec.bat in old windozes. This way you can compile in IVAN's directory using the command mingw32-make -f ivanmgw.mak instead of writing a colossal line like "mingw32-make -f D:\Programming\IVAN\ivan-0.50\ivanmgw.mak" and you don't have to modify the makefile each time you change IVAN's directory (for instance, you probably want to have a clean copy in addition to the directory with your own modifications; this way you need only one makefile for them).

TheFallenOne222- 04-11-2005

That's another way it could be done. :) I'll add that to the guide.

Atomic- 04-12-2005

This is really starting to piss me off. Every time I compile I get fatal link error -- cannot find SDL.lib. I have the dev libraries. I have every file I need, have done everything you suggested (aside from using MinGW -- kinda can't install programs on school computers...). Bloody hell.

TheFallenOne222- 04-12-2005

This is really starting to piss me off. Every time I compile I get fatal link error -- cannot find SDL.lib. I have the dev libraries. I have every file I need, have done everything you suggested (aside from using MinGW -- kinda can't install programs on school computers...). Bloody hell. Well, the tutorial is kind of intended for using MinGW, so trying it with different compilers won't help much. :P And if you're using Visual Studio 6 or .NET, I don't think it is possible to get it to properly compile with the current source. However, try finding "SDL.lib" in your SDL install directory and copying the file to your IVAN source directory. Might help. And if you can install the development libraries and such, are you SURE that it's not possible for you to install MinGW?

Atomic- 04-12-2005

The Dev libraries were easy -- download the file, open, copy paste. Installing is something else entirely. Anyway I think I got the problem solved, just before class ended -- just started moving the .lib files into the main source folder. I'll continue on Thursday and see if it works. And yeah, I'm using .NET. These link errors are the last "errors", though I'm still getting all kinds of lovely warnings about object type conversions (long to int to double, etc)

TheFallenOne222- 04-12-2005

And yeah, I'm using .NET. These link errors are the last "errors", though I'm still getting all kinds of lovely warnings about object type conversions (long to int to double, etc) Don't be so sure. I'm 95% sure you'll get a bunch more link errors as soon as you get the lib files registering correctly.

Atomic- 04-14-2005

Success! I've managed to compile under MVC.NET. Here's the steps I went through (that I can remember): 1. Get the source code. Put it someplace fairly simple. We'll say you put it in C:\ivansource\. 2. Download the SDL Dev Libraries, and put them in a folder with the source code. (for example, C:\ivansource\SDL\) 3. Attempt to build the code; you'll get lots of errors and warnings. This is just to help you jump from file to file and change what you need. Anywhere it says that it cannot open include file SDL.h, put in the full pathname to the file (which should be under C:\ivansource\SDL\include\SDL.h, assuming you put everything where I suggested). You'll probably need to compile a few times to get all of them. 4. Now you'll have more compile errors, overloaded math functions. For each of these, put the entire equation that is being modified, in a double(...) function (for example, sqrt(overworld-->cursor) becomes sqrt(double(overworld-->cursor)). That should clear those up. 5. One more step: copy all the files in C:\ivansource\SDL\lib\ to C:\ivansource\. You should now be able to successfully compile, creating an IVAN.exe file in your source folder. You might still be getting a few billion errors; these wont stop the program from compiling or executing. I'm not sure what effect they'll have on the actual program itself. Hopefully it won't break anything...

TheFallenOne222- 04-14-2005

There's a few easier ways to do what you mentioned. I'll put together something tomorrow, as right now I'm studying for exams.

Planplan- 04-21-2005

I have -*test*-('")ed the MinGW method, by registering the bin directory in my path, and it work except small change I done for compiling. When I try to compile, all instances to "include SDL.h" are wrong. I made chang to the concerned files by puting "include SDL/SDL.h" and it work. Maibe I have to register SDL for MinGW somewhere. Or kill the SDL directory to put all files one level up in the class directory. But it work, it's the more important ;) Thanks

TheFallenOne222- 04-21-2005

I have -*test*-('")ed the MinGW method, by registering the bin directory in my path, and it work except small change I done for compiling. When I try to compile, all instances to "include SDL.h" are wrong. I made chang to the concerned files by puting "include SDL/SDL.h" and it work. Maibe I have to register SDL for MinGW somewhere. Or kill the SDL directory to put all files one level up in the class directory. But it work, it's the more important ;) Thanks Which one of the two methods mentioned in the tutorial did you follow? And I STILL have to put up that second tutorial. Oopsies.

Planplan- 04-24-2005

I have -*test*-('")ed the MinGW method, by registering the bin directory in my path, and it work except small change I done for compiling. When I try to compile, all instances to "include SDL.h" are wrong. I made chang to the concerned files by puting "include SDL/SDL.h" and it work. Maibe I have to register SDL for MinGW somewhere. Or kill the SDL directory to put all files one level up in the class directory. But it work, it's the more important ;) Thanks Which one of the two methods mentioned in the tutorial did you follow? And I STILL have to put up that second tutorial. Oopsies. I say it ;) I register the bin directory in the PATH Windows environnement variable But I think the change is needed for the two methods...

Hippy- 05-26-2005

Ok you lost me at the start.

Atomic- 05-27-2005

Hippy, you really should even be in this section of the boards. The stuff here requires skill and intelligence, two things you don't appear to have. Just because there happens to be a thread around doesn't mean you should read and reply to it. Especially if it's in a section of the forum for something you don't know anything about. We're not going to teach you how to program in C++. Come back in, oh, say 5 years, after you've taken at least one class in C++ programming, and have survived a couple years of high school. Actually, give it seven or eight years. That way you'll have some semblance of maturity to boot.

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.