Compiling on Windows (VS6 or .NET (2003))

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Compiling on Windows (VS6 or .NET (2003))

Post by Darkvater »

I'm not sure if people need this topic but I've compiled oTTD on windows with VS.Net and would like to share my experiences with you. In the repository there is already a Solution file for VS.Net 2003 but if you want PNG, or ZLIB support, you will have to do some actions on your own.

I'll go point by point.
  1. if you don't have SDL download it from http://www.libsdl.org/download-1.2.php then read the SDL setup guide http://pgdc.purdue.org/sdltutorial/sdl_setup.html. You don't need SDL for windows, but if you want it, you can download and install it. If you feel you don't want to, which is most likely, the remove WITH_SDL from the release build configuration
  2. Download useful.zip from SourceForge: useful.zip
  3. Inside that you will find some needed files.
  4. Put all the header files (.h) into your Include directory, if you'd like to have zlib/png support for future projects. In most cases it is C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include
  5. You should put the 2 lib files where the project is looking for them, in your main directory (where all the .c files and solution file is)
  6. Put the .grf files to the data/ directory, together with the copied trgr*.grf files, sample.cat, etc, etc,.
Now, set the TTD as "Set as Startup Project", compile and enjoy

Note*: I had some problems with the libraries included in the useful package. If you have too, you might try the ones below. I'm using those too, and it works fine.
Attachments
libraries.zip
(114.1 KiB) Downloaded 308 times
Last edited by Darkvater on 30 Jun 2004 12:47, edited 4 times in total.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
User avatar
dominik81
OpenTTD Developer
OpenTTD Developer
Posts: 768
Joined: 16 Aug 2003 12:55
Location: Bonn, Germany

Post by dominik81 »

After compiling I get the following error when I try to run the game:

Code: Select all

No availible language packs
And when I copy english.lng from the 0.1.4 release of OpenTTD I get

Code: Select all

Invalid version of language packs
Could someone help me with that? Also it might be a good idea to include the compilation hints with the source to make it easier for people to get into OpenTTD coding.
Vurlix
OpenTTD Developer
OpenTTD Developer
Posts: 122
Joined: 07 Mar 2004 01:54

Post by Vurlix »

I'll be blunt. Everything needed to compile openttd is included in the source tree; if you don't know how to use visual studio projects, makefiles or jamfiles, don't code. It may be harsh, but you should learn to use the tools before trying to contribute.

The lng files must be generated using strgen from the txt files. This is done automatically with the jamfile and the visual studio projects -- just copy the .lng files from the lang folder to your openttd directory.
http://sf.net/projects/openttd/
Post all your patches and feature requests here.
User avatar
dominik81
OpenTTD Developer
OpenTTD Developer
Posts: 768
Joined: 16 Aug 2003 12:55
Location: Bonn, Germany

Post by dominik81 »

Wow, you really were blunt. ;) But thanks anyway, you helped me getting it to run. Was I supposed to smell that the .lng file would be dumped into a different folder? Things like that are why I think that compilation hints wouldn't be a bad idea.
User avatar
GoneWacko
Tycoon
Tycoon
Posts: 8680
Joined: 10 Jul 2002 15:08
Location: Enschede, The Netherlands
Contact:

Post by GoneWacko »

Vurlix, don't be such a dickhead. Be nice to others. I've never seen anything complementary from you.
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

My original post was for the initial release of ottd, a lot has changed since then, and it's not really valid anymore.

You indeed have to copy the generated .lng files from the 'lang' directory to the directory where you have all the graphic files, sample.cat, etc. Then if you run ottd, it will run just fine.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Vurlix
OpenTTD Developer
OpenTTD Developer
Posts: 122
Joined: 07 Mar 2004 01:54

Post by Vurlix »

GoneWacko wrote:Vurlix, don't be such a dickhead. Be nice to others. I've never seen anything complementary from you.
Open your eyes. Look at the italian translation thread, for example.
http://sf.net/projects/openttd/
Post all your patches and feature requests here.
User avatar
GoneWacko
Tycoon
Tycoon
Posts: 8680
Joined: 10 Jul 2002 15:08
Location: Enschede, The Netherlands
Contact:

Post by GoneWacko »

Wow.

Still doesn't make up for the fact that you're an ass in quite a lot of posts.
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
Vurlix
OpenTTD Developer
OpenTTD Developer
Posts: 122
Joined: 07 Mar 2004 01:54

Post by Vurlix »

GoneWacko wrote:Still doesn't make up for the fact that you're an ass in quite a lot of posts.
Very true. Perhaps I shall try to change that..
http://sf.net/projects/openttd/
Post all your patches and feature requests here.
User avatar
orudge
Administrator
Administrator
Posts: 25226
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge »

Oh, don't argue. Vurlix may be a bit blunt sometimes, but he's working on OpenTTD actively, so don't complain. ;)
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Thanks for the tips Darkvater, it works nicely. 8)

And thanx Vurlix and his ranting - I had a laugh out of it. :lol:
Keep up the good work on OpenTTD. :wink:
thorkia
Traffic Manager
Traffic Manager
Posts: 130
Joined: 25 Nov 2002 03:19
Location: Toronto, Ontario, Canada

Zlib errors on compile

Post by thorkia »

Every time I try to compile with VC++ .net, I get the following errors. I think this has to due with Zlib, but can't figure out what is wrong,

ttd error LNK2019: unresolved external symbol _inflateInit_ referenced in function _InitReadZlib
ttd error LNK2019: unresolved external symbol _inflate referenced in function _ReadZlib
ttd error LNK2019: unresolved external symbol _inflateEnd referenced in function _UninitReadZlib
ttd error LNK2019: unresolved external symbol _deflateInit_ referenced in function _InitWriteZlib
ttd error LNK2019: unresolved external symbol _deflate referenced in function _WriteZlibLoop
ttd error LNK2019: unresolved external symbol _deflateEnd referenced in function _UninitWriteZlib


Any help would be appreciated.
User avatar
dominik81
OpenTTD Developer
OpenTTD Developer
Posts: 768
Joined: 16 Aug 2003 12:55
Location: Bonn, Germany

Post by dominik81 »

You need to install Zlib.
"There's a readme that comes with the source. I suggest you read it."
- Korenn
User avatar
Bouke
Engineer
Engineer
Posts: 93
Joined: 18 Jun 2004 10:11
Location: Oudehorne (Frl), The Netherlands

Post by Bouke »

You should download the "usefull" package from sourceforge, that contains the supported zlib files. It also includes the pnglib files needed to compile. *.lib files should go into the lib/bin directory of your compiler. And also make sure you put the other files into a seperate directory (like /includes) then include this directory in the "directory includes" thing in options of VS.NET.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

I should probably update this thread just in case :wink:
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
thorkia
Traffic Manager
Traffic Manager
Posts: 130
Joined: 25 Nov 2002 03:19
Location: Toronto, Ontario, Canada

Post by thorkia »

I've done this.

I have installed Zlib 1.2.1

I have added the Lib directory to the VS.NET lib entries, pointing to the location of my zlib.lib and zlibstat.lib

But it still gives me those errors. Everything else works fine. The SDL worked, the LIBPNG worked, the onlything I am having errors with is ZLIB
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

thorkia wrote:I've done this.

I have installed Zlib 1.2.1

I have added the Lib directory to the VS.NET lib entries, pointing to the location of my zlib.lib and zlibstat.lib
You do know that this is not what I said? Anyways, I too had some problems with the libraries. Especially zlib. I attached mine at the startpost, those always work for me.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
thorkia
Traffic Manager
Traffic Manager
Posts: 130
Joined: 25 Nov 2002 03:19
Location: Toronto, Ontario, Canada

Post by thorkia »

I got it to work. Thank you for help.
User avatar
LordOfThePigs
Route Supervisor
Route Supervisor
Posts: 435
Joined: 01 Jul 2004 10:28
Location: Jura/Switzerland

Post by LordOfThePigs »

Hi,

I get the following error with VC++ 6.0:

fatal error C1083: Cannot open include file: 'dmksctrl.h': No such file or directory

It works if I undef WIN32_ENABLE_DIRECT_MUSIC_SUPPORT (but then I get no in game sound)

I can't find this file anywhere on my system, what should I install to get this to run?

Lord of the Pigs
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

LordOfThePigs wrote:Hi,

I get the following error with VC++ 6.0:

fatal error C1083: Cannot open include file: 'dmksctrl.h': No such file or directory

It works if I undef WIN32_ENABLE_DIRECT_MUSIC_SUPPORT (but then I get no in game sound)

I can't find this file anywhere on my system, what should I install to get this to run?

Lord of the Pigs
I think you need to download the DirectX SDK.

Altough I'm not sure cause I am using VS.NET and it must already be included in the .NET Framework.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 3 guests