Jump to content
Eternal Lands Official Forums
crusadingknight

Windows Compilation Guide

Recommended Posts

ONLY PROGRAMMERS WHO NEED TO UPDATE THIS COMPILATION GUIDE SHOULD POST HERE!

 

 

Compiling Eternal Lands with Dev-C++

Updated guide by Emajekral

 

 

Before attempting this Guide please start with a fresh CVS checkout. If you have made changes to and .c .cpp or .h files you can copy them over later. You may wish to reinstall Dev-C++ as well. I do that every time I refresh this guide.

 

Now, a step by step Dev-C++ install and compilation:

 

Get Code

 

Get code from cvs: TortoiseCVS works well, just follow directions in head post.

Go to the directory where you want to checkout the source, then right click in the explorer window, and select "CVS Checkout", and specify the CVSROOT- :pserver:anonymous@cvs.elc.berlios.de:/cvsroot/elc

the specify the module- elc

Then press OK to checkout the source.

 

Get Compiler

  • Get this version of Dev-C++.
  • Start it and go oooh, aaaah!

Set Up Compiler

Set up your development libraries by clicking these links, downloading what's there and clicking next until Finish shows up.

(Placid, there's several new libraries. I'm hosting them at my University, but I'd prefer if they were elsewhere... please?)

I just made these three DevPaks. I've tested them, but I don't trust them. Please try them and report any problems you have.

The glext.h that comes with Dev-Cpp is out of date. Save the new version in C:\Dev-Cpp\include\GL\ by right clicking on this link: glext.h

 

At this point you have two choices:

  • While you are in c:\dev-cpp\include copy the contents of the "AL" and "SDL" directories up one level to c:\dev-cpp\include (Hack way)
    OR
  • Tell Dev-Cpp that you want AL and SDL directories to be in the include path. (Right-er way)
    • Go to Tools>Compiler Options
    • Click on the Directories tab
    • Click on the C Includes tab
    • Click on the button just above the Delete Invalid button. It's next to a small empty text box. It opens a folder browser.
    • Find c:\dev-cpp\include\SDL and press OK
    • The empty textbox now has c:\dev-cpp\include\SDL in it. Press the add button.
    • Repeat the last three steps for c:\dev-cpp\include\AL (or copy and paste the directory into the empty box. Your choice.***Don't forget to "Add" the directory***)

Create Your Project

  • Now click on File > New > Project...
     
  • Make this:
    • an Empty Project
    • a C Project

    and Give it a name... I recommend el

    [*]Save the project in your elc development directory - NOT the Dev-Cpp directory that you see as a default

    [*]Click on Project > Add to Project

     

    [*]Click on the upper rightmost file or directory.

     

    [*]Press and HOLD the shift key.

     

    [*]Hit combinations of Page Down and the arrow keys until all files are selected. (Alternately click then scroll all the way to the right, hold shift and click on the last file you see.)

     

    [*]Release the shift key.

     

    [*]Locate cal3dwrapper.c and cal3dwrapper.h

     

    [*]Press the control key.

     

    [*]Click those two files.

    [*]Press the "Open" button.

    [*]Wait while Dev-C++ processes these files.

Configure Your Project

  • Press Alt + P or click Project > Project Options
  • Click the "Makefile" tab.
  • Click the "Use Custom Makefile" checkbox
  • Include Makefile.win - yu may need to navigate to your cvs directory. Typing *win in the "file name" box will make finding the file easier.
  • in your CVS checkout directory rename make.default to make.conf
  • open make.conf (use notepad) and add this line to the end
    EXTRA_LIBS=-lstdc++
    EXTRA_INCLUDES=-IC:\\Dev-Cpp\\Include\\AL -IC:\\Dev-Cpp\\Include\\SDL


Compile Your Project

  • Click Compile, or Execute > Compile, or Ctrl + F9.
  • Wait.
  • You will get some warnings (about 1 three lines long about strstr last time I wrote this ).
  • Ignore them (unless you're on the Dev team. C'mon guys... ;P )

Install Your Compiled Project

  • Copy el.exe from your CVS folder to your Eternal Lands folder (This would be c:\Program Files\Eternal Lands\ by default)
  • Back up cal3d.dll if the Eternal Lands folder you are using is your only one (Bad plan).
  • Go to c:\dev-cpp\dll
  • Copy the libcal3d.dll and libcal3d_extra.dll you found there to the same folder you copied YourProjectName.exe
  • You may have to overwrite the existing cal3d.dll file.
  • Copy alut.dll from c:\dev-cpp\lib the folder where you copied the previous 3 files.

Run. Enjoy.

 

Jun. 12/07 update: Changed instructions to handle changes brought on by EYE_CANDY. Made DevPaks for libraries that needed them. (glext.h doesn't have one cause its not worth the effort.)

 

 

 

 

 

 

 

 

 

 

 

 

OLD GUIDE BELOW

-------------------------------------------------------------------------------------

 

 

 

 

 

 

 

Table of Contents

  • 1. Getting a CVS program and the CVS code
    • 1.1 using WinCVS
    • 1.2 using TortoiseCVS

    [*] 2. Getting and installing libraries

    • 2.1 using DevC++
    • 2.2 using Microsoft Visual C++

    [*] 3. Compiling and installing the EL Client

    • 3.1 using DevC++
    • 3.2 using Microsoft Visual C++

    [*] 4. Final Installation

1. Get a CVS program and CVS code

 

1.1 WinCvs Download (3.48 mb). Next, install both exe files that come with that package (if you got wincvs). Start up your CVS and don't worry if it nags you about python because you don't need it. Then go to the command prompt part at the bottom and type:

 

cvs -d:pserver:anonymous@cvs.elc.berlios.de:/cvsroot/elc login

 

cvs -z3 -d:pserver:anonymous@cvs.elc.berlios.de:/cvsroot/elc co modulename

 

Fill in modulename with "elc" without quotes. Now you should have a complete set of the source code and the folder called actor_defs which will be very important later.

 

 

1.2 TortoiseCVS Download (4.7 MB)

Go to the directory where you want to checkout the source, then right click in the explorer window, and select "CVS Checkout", and specify the CVSROOT- :pserver:anonymous@cvs.elc.berlios.de:/cvsroot/elc

the specify the module- elc

Then press OK to checkout the source.

 

 

 

2. Getting and Installing the libraries

 

2.1 MICROSOFT VISUAL C++

You will need 6 libraries and an OpenGL SDK to compile the code. Get the win32 versions of libxml, OggVorbis, OpenAL, iconv, SDL, and SDL_net. You will also need Glut which is part of OpenGL. Here are the versions I got to compile Eternal Lands 1.0.1:

libxml2-2.6.19.win32 (1.40 mb)

OggVorbis-win32sdk-1.0.1 (2.27 mb)

OpenAL SDK (version 1.0) (8.50 mb)

iconv-1.9.1.win32 (1.21 mb)

SDL-devel-1.2.8-VC6 (546 kb)

SDL_net-devel-1.2.5-VC6 (21.1 kb)

I also got glut-3.7.6-bin (117 kb) since the OpenGL sdk I had did not come with Glut.

 

Go to the OpenGL page to figure out how to get the OpenGL SDK if it is not already installed.

 

Now you need to put all the .h files from those into a folder called "include". A lot of those packages already have their .h files in a folder named that so just copy them all over. Then you will need another folder called "lib". Put all .lib and .dll files in there. Now you need to set the path in your compiler so that it knows where all of these files are. In Visual Studio.NET go to Tools->Options->Projects->VC ++ Directories. Then add the path to your include file in the include section and the path to your lib file in the libraries section.

 

 

2.2 BLOODSHED DEV-C++

Open Dev-Cpp, and go to Tools->Check for Updates/Packages, and download select versions of the following packages:

 

libxml2-2.6.19.win32

OggVorbis-win32sdk-1.0.1

OpenAL SDK (version 1.0)

iconv-1.9.1.win32

SDL-devel-1.2.8-VC6

SDL_net-devel-1.2.5-VC6

 

You may need to switch mirrors to get all of the packages. Dev-Cpp will install all of the files to their correct directories.

 

 

 

3. Compiling and Installing The Eternal Lands Client

 

3.1 MICROSOFT VISUAL C++

Open the elc.dsw file and compile.

In VC.NET it will complain that elc.dsw is a VC6 format and if you want to convert to VC.NET format. Click yes. Now when you go to open your project file for EL always open elc.sln.

Don't worry about the map editor code because chances are you don't need it. I couldn't get it to compile so you will probably have trouble with it also.

Now make sure cal3dwrap.c and cal3dwrap.h are removed from your project (called a solution in .NET). You do not want those files because right now they will give you errors.

 

This part is very important if you are using Visual Studio.NET. Open global.h and type

#define inline __inline

Put that after the line: #define __GLOBAL_H__

 

It seems to be nice to include elc_private.rc to your project (solution) although it is probably not necessary. It looks like it adds the right icon for the exe file once it is created.

 

You will probably want to compile the EL client using the Debug setting the first time (or if you want to debug the code). You could also compile it in Release mode if you know what you are doing. You will get better performance from Release.

 

Also you may need to compile with the /D "ELC" flag set in the Property Pages under Command Line. I think mine worked without it though. Then, just compile/link the code.

 

Now you should have a compiled exe. It should be in a folder called Debug or Release where ever your eternal lands CVS code is. Copy that exe file to where ever you have eternal lands installed. If you compiled in Debug mode you will need some extra .dll files in your EL game directory. Eternal Lands will nag you until you have the right .dll files. The debug dll files start with the same name but end with _d.dll so they should be easy to find.

 

You might notice that the music won't play. I am still trying to figure out how to get that working. I'll update or add to this thread once I figure that out. Also, the CVS EL client code seems to hang on exit. Ctrl Alt Delete eternal lands to close it. Again, I'm not sure why that is happening. Be sure to check out http://elc.berlios.de/build.php to find links to get the libraries or for build instructions on other platforms.

 

 

3.2 BLOODSHED DEV-C++

On Dev-Cpp, just create a new C project with all of the files, except cal3dwrap.c and cal3dwrap.h. Then, you can just hit compile, or you can use the default Makefile by opening Project->Project Options, select Makefile, tick off "Use Custom Makefile", click the button on the right (Load), and select Makefile.win, THEN hit compile.

 

If you chose not to use the makefile, set up the parameters as follows:

Open Project->Project Options, open the tab Parameters. Then add the following to

"Compiler":

-DWINDOWS -Wall -DELC -DWINDOW_CHAT -DNOTEPAD -DSTORAGE

--Note that the three last of these will be removed in the future.

Then, add this under the "Linker" column:

-mwindows -lSDL -lopengl32  -llibxml2 -lSDL_net -lALut -lOpenAL32 -lvorbisfile -liberty C:\Dev-Cpp\lib\iconv.lib

--Note that the last changes depending where you installed Dev-C++ to.

Then, hit the compile button.

 

BTW, be sure to copy over the created executable to your Eternal Lands directory, unless you building straight to that directory. (As set in Project->Project Options, Build Options). DO NOT ATTEMPT TO RUN THE COMPILED EXECUTABLE WITH THE DEV-C++ RUN BUTTON - it will have undesirable results.

 

 

 

4. Final Installation

 

And now the MOST IMPORTANT step is to COPY the folders called actor_defs and languages from your Eternal Lands CVS folder to your Eternal Lands game folder. If you do not do this the game will come up to the log in screen and the program will crash when you try to play. MAKE SURE YOU DO THIS. After that you should be good to go.

 

 

Authors:

  • Ryldnozz
    • Getting the source code with WinCVS
    • Compiling With Microsoft Visual C++

    [*] CrusadingKNIGHT

    • Getting the source code with TortoiseCVS
    • Compiling with Bloodshed Dev-C++

Edited by Roja

Share this post


Link to post
Share on other sites

I'm going to add two additional things for Emajekral's How-to here (in the pinned thread) so they don't get lost.

 

These are considered ADVANCED OPTIONS. You can attempt them after you have tested your client compiles correctly!

 

Option 1 - Removing the debug DOS window from your new client. Thanks to Labrat.

 

Change the options line in Makefile.win to this:

OPTIONS = -DWINDOWS -DELC -mwindows $(foreach FEATURE, $(FEATURES), -D$(FEATURE))

-mwindows tells gcc to compile for Windows (specifically do not generate a console window)

 

 

 

The next 2 options use the section of the makefile that originally looks like this:

$(EXE): main.o $(TMP_LIB)
$(LINK) $(CFLAGS) $< -L. -lelc $(LDFLAGS) -o $(EXE)

 

Option 2 - Adding the EL icon to your new client. Thanks to Emajekral.

 

Change the instructions for the $(EXE) target in Makefile.win to this:

$(EXE): main.o $(TMP_LIB)
windres elc_private.rc elc_private.o
$(LINK) $(CFLAGS) $< -L. -lelc $(LDFLAGS) elc_private.o -o $(EXE)

Some gotchas about this option. Sometimes I find the elc_private.* files get corrupt and the compile fails. If this occurs remove those files and re-update your source code (or update with the option -C).

 

 

Option 3 - Making the client smaller. Thanks to Emajekral.

 

Change the instructions for the $(EXE) target in Makefile.win to this:

$(EXE): main.o $(TMP_LIB)
$(LINK) $(CFLAGS) $< -L. -lelc $(LDFLAGS) -o $(EXE)
strip -s $(EXE)

The strip command removes the debugging symbols from the client executable so don't use this option if you are debugging your client (running under gdb or another debugger).

 

Note: Options 2 and 3 can be combined by added the "strip -s $(EXE)" command to the end of option 2 (on a new line of course).

$(EXE): main.o $(TMP_LIB)
windres elc_private.rc elc_private.o
$(LINK) $(CFLAGS) $< -L. -lelc $(LDFLAGS) elc_private.o -o $(EXE)
strip -s $(EXE)

 

/edit: More tidying etc.

Edited by Roja

Share this post


Link to post
Share on other sites

Placid's site has changed to http://el.beplacid.net/dev/win-libs/ however I am getting 403 forbidden on some of the files, notably the new cal3d ones :(

 

No cal3d means no compile for me (my systems have been wiped)

Share this post


Link to post
Share on other sites

One thing that has slipped through the gaps is that icon.bmp is not supplied in the CVS or standard distribution. The result of this is that the CVS client does not have an icon when it is windowed.

 

I have made one from eternallands.ico, it is available here:

edit:

Well.. this board doesn't allow the displaying of .bmp files :/ I was going to display the picture in this post, guess not :P

Edited by LabRat

Share this post


Link to post
Share on other sites

Hey,

 

I was trying to get el to compile on my XP VM, and found out that almost none of the links on the howto work.

 

I guess placid removed the stuff when he changed servers. This poses some difficulties because some packages (freealut, etc) are not available elsewhere.

 

Most of them can be obtained from 3rd parties, but some do not - as a result, I (and probably some more people) are unable to compile EL for windows - I still have issues with openalut.

 

Just to let you all know, please remove this post after.

 

Álvaro

 

Side note: the "glext.h" that works is SGI one (you can get it here. I spent almost an hour looking for one that would work (the one I have is nvidia one).

Edited by alvieboy

Share this post


Link to post
Share on other sites
I was trying to get el to compile on my XP VM, and found out that almost none of the links on the howto work.

 

I guess placid removed the stuff when he changed servers.

Hmmmm. Yes, this has been noted a couple of times and the people with access must have forgotten to update the post. The new domain is beplacid.net and the files are now under the downloads directory. You can find the list of them here: http://el.beplacid.net/downloads/

Share this post


Link to post
Share on other sites

Hmmmm. Yes, this has been noted a couple of times and the people with access must have forgotten to update the post. The new domain is beplacid.net and the files are now under the downloads directory. You can find the list of them here: http://el.beplacid.net/downloads/

 

Er... no development stuff there I'm afraid.

 

There's a http://el.beplacid.net/dev/ link, but also only one file there (keys.diff).

 

Once I get OpenAL/alut to work I can post here some links that work.

 

Álvaro

Share this post


Link to post
Share on other sites
Change the options line in Makefile.win to this:

OPTIONS = -DWINDOWS -DELC -DWINVER=0x500 -mwindows $(foreach FEATURE, $(FEATURES), -D$(FEATURE))

 

Added -DWINVER=0x500 to reflect this error:

gl_init.c:127: warning: implicit declaration of function `MonitorFromWindow'

gl_init.c:127: error: `MONITOR_DEFAULTTOPRIMARY' undeclared (first use in this function)

Edited by ago

Share this post


Link to post
Share on other sites
Change the options line in Makefile.win to this:

OPTIONS = -DWINDOWS -DELC -DWINVER=0x500 -mwindows $(foreach FEATURE, $(FEATURES), -D$(FEATURE))

 

Added -DWINVER=0x500 to reflect this error:

gl_init.c:127: warning: implicit declaration of function `MonitorFromWindow'

gl_init.c:127: error: `MONITOR_DEFAULTTOPRIMARY' undeclared (first use in this function)

 

Keep in mind that anyone compiling under Win98 still will need WINVER set to 0x0410, and anything compiled with 0x0500 might not work with Win98.

 

Yes, there are still people using Win98 out there ... they've had to manually install a file in the past to get it to work.

Share this post


Link to post
Share on other sites

Is there any reason why the options line wouldn't default to this for the makefile.win?

 

OPTIONS = -DWINDOWS -DELC -DWINVER=0x500 -mwindows $(foreach FEATURE, $(FEATURES), -D$(FEATURE))

 

And also why not have the EL icon in, and debugging info off by default?

 

 

$(EXE): main.o $(TMP_LIB)
windres elc_private.rc elc_private.o
$(LINK) $(CFLAGS) $< -L. -lelc $(LDFLAGS) elc_private.o -o $(EXE)
strip -s $(EXE)

 

 

It's a pain to have to change these everytime I get a new cvs download and want to compile. I suggest the most used options be put in default, and the others you can add/subtract to this file if you want it or something that makes it quicker than having to go to this forum thread and find the right lines every single time.

Share this post


Link to post
Share on other sites
Ok I updated the Makefile in the cvs with these changes.

The changes work fine for me using dev c++. When I tried before, dev c++ was overwriting the elc_private.rc file even though I had unticked the "Include version information in project". It wasn't until I unticked (the greyed out) option "Auto-increment build number on compile" too, that dev c++ stopped overwriting the file. The dev c++ version of the elc_private.rc file, for some reason adds an #include to include itself! The only issue now is that the CVS version of elc_private.rc is out of date with the current version number.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×