News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

How to compile Simutrans (&Makeobj) on Windows with MSVC

Started by VS, October 20, 2008, 08:27:42 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

VS

Note in 2016: This is now too old (16-8 = 8 years!). You can glean some helpful things from this, but don't expect anything to work as described here. Sorry.

Note: This is now a bit old. I have updated the text & files as possible, but MSVC 2010 has a bit different menus and I don't have (now) access to computer with it. Keep telling me to fix this :P

It is quite easy - I almost feel sorry to spare you from recompiling dependencies with GCC and such jokes. Well, real hackers don't have to follow :D

I don't know if this works for 64bit OSes.

I omitted restarting system, you'll have to do so probably twice.

1 ) Download Microsoft Visual C++ - for free,
2 ) install it.
3 ) Download precompiled libraries for OpenTTD - follow link with highest number, then download the zip file with binary data; its name might include win and should not contain source or ***sum.
4 ) Unpack this zip file somewhere - as an example, C:\example\ottd_libs. Inside this folder you should have a bunch of folders, namely win32 and shared.
5 ) From Dwachs' post, download header and libary and unpack the zip. The .h file goes to shared/include and .lib to win32/library.
6 ) Get the pthreads library for Win32. From the folders select the one with highest prebuilt-dll-x-y-z-release number. You should know now where the lib and h files go ...
Important: You need the DLL. Put it where your pak folders are!
7 ) Start MSVC and in menu, go to options (tools->options), a window opens with another set of choices to the left, you want to change directories (projects and solutions->VC++ Directories);
8 ) the dropdown menu in the top-right corner (it says Executable files at first) - set it to include files and add to list folder shared/include from the downloaded archive - example, C:\example\shared\include.
9 ) Do the same with library files - add there win32/library - example C:\example\win32\library.

Now you're set up for compiling - but don't have the sources!

10) Install Tortoise SVN (it integrates into Explorer).
11) Create new folder - eg. simutrans_src.
12) Click on it with right mouse button - choose SVN Checkout. A window pops up.
13) URL is svn://servers.simutrans.org/simutrans - Leave the other options be, they're all correct.
14) OK!
15) If asked for password, enter user anon and leave password empty.
16) Downloading...

(Alternatively you can use the command line svn - that is not material for this guide as it's aimed for click-and-go solution)

And now - Christamaaaaas!

17) In the folder downloaded from svn (maybe simutrans_src) go to simutrans\trunk - you can see the lot of source files.
18) Open file simutrans.vcproj.
19) It is from older version, you have to go through wizard for project file update. Again no need to change any settings.
20) Once this is completed, to the left should appear some stuff (Solution Simutrans blah blah). In menu, choose Build->build solution.
21) Waiting...
22) Simutrans executable appears in folder debug (inside the folder with sources is folder Debug).

If you want to run simutrans from MSVC for debugging, you need to change the project properties -> debug
THe command line needs to start with -use_workdir and the working directory should point to the simutrans folder than contains your pak-folders (and the DLL).

Enjoy!



EDIT: The above will always work. Below depends on updated attachments. Thus if this does not work, use the above way.

You can save yourself the trouble with steps 17-18 and use the attached project files. They go to trunk/MSVC2k8/*.* - in other words, in folder trunk you should have a folder MSVC2k8 and in it some files. This is on purpose, so that you don't overwrite any files tracked by svn.

When they are outdated, post here and demand new.

EDIT: instead of attachment, link:
http://vs.simutrans.com/misc_files/simu-MSVC2k8.zip

EDIT: Added pthreads. Corrected ftp link.

EDIT2: For r7808 onwards you need to set the "character set" in "properties->general" to "undefined" or "no set" and not Unicode (depending on your interface langauage).

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

vilvoh

#1
cool!! Some people asked me about how to apply the overtaking patch in windows, and I even know how to compile Simutrans in windows. Is there any possiblity that somebody can explain how to apply a patch in windows?

P.S: I guess it's based on the wiki info, isn't it? In that case I think we might consider that everything is right and clear. Unless, until I try and fail... :D

Escala Real...a blog about Simutrans in Spanish...

VS


My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

vilvoh


Escala Real...a blog about Simutrans in Spanish...

VS

Aha. So there is something at all on wiki. Interesting... thanks to whoever started putting it back into shape!

As to patches - well that can be done via Tortoise, too, but honestly no idea how it goes, I never tried it.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

vilvoh

#5
I think that was thanks to Stormoog or Whoami effort. In reference to applying patches using TortoiseSVN, I've found this tutorial and this thread from TT-forums. It seems very easy so I'll try it later.... :)

Escala Real...a blog about Simutrans in Spanish...

wernieman

Only for the information:

If you have a big patch, and is the patch testet, I could make every time a spezial run of the nightly-Server!

But not for every "little" pach  8)
I hope you understand my English

vilvoh

#7
I know. In fact, most of the requests were about the famous overtaking fun patch but as it's still under development and the nightly that included that patch is not available, people ask about how to apply that patch to Simutrans.

P.S: Does it mean that we might do requests for special nightlies?  ::)

Escala Real...a blog about Simutrans in Spanish...

wernieman

In the last nightly is the overtaking patch .. or???

When you send me a Mail I can make a "spezial run"

I hope you understand my English

vilvoh

Well, If I remember correctly, the last nightly that included that patch was 2008-09-15_v100.1_r2022-overpatchV7, wasn't it?

Escala Real...a blog about Simutrans in Spanish...

wernieman

In the SVN log of the code:
28.09.2008 ADD: (isidoro/prissi) overtaking for road vehicles/citycars

so since 28.09.2008 is the patch in the code ....
I hope you understand my English

vilvoh


Escala Real...a blog about Simutrans in Spanish...

vilvoh

I'm trying to write a series of articles for the blog with the title: Dive in Simutrans (python guys will get it..;)) They're all in spanish, and one of them is just a translation on VS post above with some extra details, but I might translate them to EN and compile all of them in a short guide, lets call it Simutrans Compiling Guide or Dive in Simutrans. Perhaps this encourage people to take part in the code development, what do you think?

Escala Real...a blog about Simutrans in Spanish...

VS

Of course! I thought about posting this for about a second - and then of course put it here. It helps people get started, so why not.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

vilvoh

#14
Ok, so I'll translate them. This is the list of articles (in spanish) that are available at this moment in the blog Escala Real:

Only miss another one about how to create a piece of code and add it to simutrans sources, but as I'm not an expert on that, I'll need help from somebody who has more experience dealing with those issues. Anyway, I think with these three articles it's enough to encourage people to code something for Simutrans.

I'm going to finish this post with two programming quotes:
"Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots.  So far the Universe is winning."
(Rich Cook)

"First learn computer science and all the theory.  Next develop a programming style.  Then forget all that and just hack."
(George Carrette)


Escala Real...a blog about Simutrans in Spanish...

prissi

While I can agree to some degree with the first I certainly cannot agree with the second. I am doing the reverse and trust me, with the (for me) modern abstract object oriented concepts, first knowing what one is doing makes hacking easier. I mean I main self-taught programming in the early 80ies with book from the mid 70ies -- no OOP at all.

isidoro

Quote from: vilvoh on October 21, 2008, 09:46:27 AM
[...]
Only miss another one about how to create a piece of code and add it to simutrans sources, but as I'm not an expert on that, I'll need help from somebody who has experience more experience dealing with those issues.
[...]

If I can be of any help, please tell, although I left the dark side of the Force long time ago (two years or so)...

In fact, there is not much to it.  My weapons are:

  • A good text editor (kate)
  • A good compiler/debugger couple (gcc/gdb)
  • A search tool (grep)
  • A good versioning tool (which better than svn itself?)
  • A web-translator from German (like Google's)
  • Lots of sticky notes

With the debugger, one can figure out the variables and functions used for something, then one can inspect the code and then modify, and try.  Once done, generating the patch is very easy.  Simutrans code is well documented and easy to follow, imho, but the language is a problem for non-German speakers like me...

Quote from: prissi on October 21, 2008, 10:20:26 AM
While I can agree to some degree with the first I certainly cannot agree with the second. I am doing the reverse and trust me, with the (for me) modern abstract object oriented concepts, first knowing what one is doing makes hacking easier. I mean I main self-taught programming in the early 80ies with book from the mid 70ies -- no OOP at all.

I certainly belong to The Low-level Lonely Hearts Club Band...

VS

#17
Here are updated project files for this ide.

Unpack this so that you get folder trunk/MSVC2k8 and there the files (sln and vcproj) (with this you can skip steps O,P,Q).

EDIT: removed and added to first post.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Dwachs

@VS: thank you for this nice introduction. The Windows-Zip-extraction program refuses to extract the libs-files and I had to do this by hand ???
Parsley, sage, rosemary, and maggikraut.

VS

Strange. Well if you got it to work anyway, congrats! :)

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Roads

Which do y'all recommend downloading, Visual C++ 2005 or 2008?

vilvoh

I suppose it doesn't matter but I used the latest version (2008)

Escala Real...a blog about Simutrans in Spanish...

VS

I hear everyone (elsewhere) say 2005 was the last good version... but I just wanted something and grabbed the first thing I saw.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Roads

OK, thanks fellas.  I've got a trial version of 2005 now, (it came with a game tut I bought).  Prior to that I had used the toolkit to compile for mods for Civ.  Since I'm kinda familiar with 2005, I'll probably download it.

VS


My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Dwachs

Now simutrans needs an additional library: bzlib. Here are header and lib-files. Put them in your include/library directories.
Parsley, sage, rosemary, and maggikraut.

prissi


Aglezabad

Hello:

I have tried to compile the code following the instructions, but it does not generate the feasible one. It appears 62 errors and approximately 1000 warnings, but it does not create the programme. My system is Windows 7 x64 and I use Visual C ++ 2008.
I have put bzip files.

Regards and thanks.


wernieman

If you give us the output of your compiling-test, whe COULD help ....
I hope you understand my English

Aglezabad

The disadvantage is that it is in Spanish some parts.


wernieman

1. could you make a new thread
2. sorry, but when i decompress your log then it is empty :o(
I hope you understand my English

Aglezabad

1.Thanks
2.Sorry, I will upload the file to other server.

jamespetts

I am having some trouble compiling Simutrans-Experimental with the new network module - I am wondering whether there is something specific to Simutrans-Experimental that is causing the problem, or whether I am doing something wrong more generally. Here is the output that I get, with numerous linker errors:


1>Linking...
1>simworld.obj : error LNK2019: unresolved external symbol _send@16 referenced in function "public: bool __thiscall karte_t::laden(char const *)" (?laden@karte_t@@QAE_NPBD@Z)
1>network.obj : error LNK2001: unresolved external symbol _send@16
1>network.obj : error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function "bool __cdecl network_initialize(void)" (?network_initialize@@YA_NXZ)
1>network.obj : error LNK2019: unresolved external symbol _connect@12 referenced in function "char const * __cdecl network_open_address(char const *,unsigned int &)" (?network_open_address@@YAPBDPBDAAI@Z)
1>network.obj : error LNK2019: unresolved external symbol _socket@12 referenced in function "char const * __cdecl network_open_address(char const *,unsigned int &)" (?network_open_address@@YAPBDPBDAAI@Z)
1>network.obj : error LNK2019: unresolved external symbol _htons@4 referenced in function "char const * __cdecl network_open_address(char const *,unsigned int &)" (?network_open_address@@YAPBDPBDAAI@Z)
1>network.obj : error LNK2019: unresolved external symbol _inet_addr@4 referenced in function "char const * __cdecl network_open_address(char const *,unsigned int &)" (?network_open_address@@YAPBDPBDAAI@Z)
1>network.obj : error LNK2019: unresolved external symbol _listen@8 referenced in function "bool __cdecl network_init_server(int)" (?network_init_server@@YA_NH@Z)
1>network.obj : error LNK2019: unresolved external symbol _bind@12 referenced in function "bool __cdecl network_init_server(int)" (?network_init_server@@YA_NH@Z)
1>network.obj : error LNK2019: unresolved external symbol _htonl@4 referenced in function "bool __cdecl network_init_server(int)" (?network_init_server@@YA_NH@Z)
1>network.obj : error LNK2019: unresolved external symbol _recv@16 referenced in function "unsigned int __cdecl network_check_activity(int,char *,int &)" (?network_check_activity@@YAIHPADAAH@Z)
1>network.obj : error LNK2019: unresolved external symbol _inet_ntoa@4 referenced in function "unsigned int __cdecl network_check_activity(int,char *,int &)" (?network_check_activity@@YAIHPADAAH@Z)
1>network.obj : error LNK2019: unresolved external symbol _accept@12 referenced in function "unsigned int __cdecl network_check_activity(int,char *,int &)" (?network_check_activity@@YAIHPADAAH@Z)
1>network.obj : error LNK2019: unresolved external symbol ___WSAFDIsSet@8 referenced in function "unsigned int __cdecl network_check_activity(int,char *,int &)" (?network_check_activity@@YAIHPADAAH@Z)
1>network.obj : error LNK2019: unresolved external symbol _select@20 referenced in function "unsigned int __cdecl network_check_activity(int,char *,int &)" (?network_check_activity@@YAIHPADAAH@Z)
1>network.obj : error LNK2019: unresolved external symbol _closesocket@4 referenced in function "void __cdecl network_close_socket(unsigned int)" (?network_close_socket@@YAXI@Z)
1>network.obj : error LNK2019: unresolved external symbol _WSACleanup@0 referenced in function "void __cdecl network_core_shutdown(void)" (?network_core_shutdown@@YAXXZ)
1>..\simutrans-experimental-binaries\Simutrans-Experimental-debug.exe : fatal error LNK1120: 16 unresolved externals


Have others experienced those errors, or do they seem specific to Simutrans-Experimental?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

knightly

It was caused by the missing reference to wsock32.lib in the project file. James has fixed it by now.

VS

I have updated the guide to match new openttd pages, bz2 dependency and uploaded new files. Please report problems if they happen...

Note: it's still for version 2008, not 2010. I will fix that once I will be able to access my work computer...

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Dwachs

Project files in first post are outdated. Could you upload updated versions?
Parsley, sage, rosemary, and maggikraut.

prissi


HDomos

Quote from: VS on October 20, 2008, 08:27:42 AM

6 ) Start MSVC and in menu, go to options (tools->options), a window opens with another set of choices to the left, you want to change directories (projects and solutions->VC++ Directories);
7 ) the dropdown menu in the top-right corner (it says Executable files at first) - set it to include files and add to list folder shared/include from the downloaded archive - example, C:\example\shared\include.
8 ) Do the same with library files - add there win32/library - example C:\example\win32\library.


In Microsoft Visual Studio 11 you cant do this (menu structure change as you wrote).
Instead you can do this:

In the menu open Project>Simutrans properties
In the popping window, go Configuration Properties>VC++ Directories
There you can specify the include and the library directories

VS

This thread needs an overhaul replacement... :( Has it really been 4 years?

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

hreintke

LS,

Followed the procedure, downloading and configuring all went OK (I think), used MSVC 2010.
During compile only few warnings but during link I get the error

1>simsys.obj : error LNK2001: unresolved external symbol __imp__ShellExecuteExA@4

Did anyone see this too and/or know how to resolve this ?

Kind regards,

Herman

Dwachs

Parsley, sage, rosemary, and maggikraut.

hreintke

Hello Dwachs,

I used both DEBUG and RELEASE build. Both with the same result.

Only difference is an additional warning in debug : 1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification

But also the errormessage : 1>simsys.obj : error LNK2001: unresolved external symbol __imp__ShellExecuteExA@4

Kind regards,

Herman

Dwachs

Maybe you need to add the dependency on the library file shell32.lib.

Would you please post a diff file for the project files if you got it fixed? Then we can update the project file in the repository.
Parsley, sage, rosemary, and maggikraut.

hreintke

Dwachs,

Thanks very much. Adding the shell32.lib to debug and release additional dependencies properties solved it.

I will clean up my config first and then provide the diff. Otherwise everyone might end up with more updates then needed because of my trial and error before finding the solution.

Will come shortly.

Herman

prissi

The MSVC2010 project file is a mess, containing abosulte path and so on, and of course also the makeobj creation is missing. After release I will work on a new one. I rather recommend to import the MSVC 2008 project file as a start.

Spartanis

Quote from: VS on April 08, 2012, 05:26:38 PM
This thread needs an overhaul replacement... :( Has it really been 4 years?

LOL.. I agree.. Im planning to learn MSVC and all that jazz and then fiddle around Simutrans Coding after i done my Pakset, next year or so. I really would LOVE to be part of this team any way i can...

:)

hreintke

LS,

To get a good understanding of msvc/simutrans I also took the way prissi suggested and took the msvc 2008 project file as a start.

That takes me however to a project which doesn't compile because it cannot find pthread.h.
Looked at the include and it is preceded by #if MULTI_THREAD>1 so I could remove the dependency for now by setting the option.

But.. I cannot find the location where to find or put it. In my MinGW there is a file called config.default, but here this must be msvc project configuration specific. Can you help me on this ?

Herman

prissi

YOu have to right click (1) and select project properties. then got to the C++ (2) entry in the tree on the left, then Preprocessor (3). Click on box 4 to see the dialoge.

Lus1531

I had taken source code of r6298 from svn, but I could'nt build using MSVC2010 because "api_gui.cc" has not been added to project.
I hope the development team to update project file.
BattleSimutrans project(Japanese)
In japanese,"Lus" is spelled "ラス".

jamespetts

The link to the pthreads download in the first message is missing a colon, and redirects to a spam page about terminal emulators. The correct link is ftp://sourceware.org/pub/pthreads-win32/.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Lus1531

That link is incorrect same the first message.
Use ftp tags for ftp link,it can be linked.
[ftp]ftp://sourceware.org/pub/pthreads-win32/[/ftp]
ftp://sourceware.org/pub/pthreads-win32/
BattleSimutrans project(Japanese)
In japanese,"Lus" is spelled "ラス".

jamespetts

Ahh - a quirk of the board code! Thank you: that is helpful.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Dwachs

Parsley, sage, rosemary, and maggikraut.

Sarlock

Pulling my hair out...

Warning   1   warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification   C:\Program Files (x86)\Simutrans\source code\LINK   Simutrans
Error   2   error LNK2001: unresolved external symbol "void __cdecl export_gui(struct SQVM *)" (?export_gui@@YAXPAUSQVM@@@Z)   C:\Program Files (x86)\Simutrans\source code\export_objs.obj   Simutrans
Error   3   error LNK1120: 1 unresolved externals   C:\Program Files (x86)\Simutrans\source code\Debug\Simutrans.exe   1   1   Simutrans

Stumbled through a host of other problems before and slowly resolved them one by one but this one has stonewalled me.  Having never compiled C++ and never used MVSE (2012) before this is quickly proving to be an exercise in frustration.  And all I want to do is figure out how to install that .diff so that I can test my new landscape tiles that I drew...  :-[
Current projects: Pak128 Trees, blender graphics

hreintke

Sarlock,

Replying without access to my own compile environment so it is from memory.
I think I encountered this when updating my own copy to the latest trunk.

My solution then was to include script/api_gui.cc in the project.

Herman

VS

You're on the right track, if you got so far!

As files are added to code, they're - obviously - missing in the old project file, so there will be a long exercise in finding files to add. You can try the attached project file - it lists everything needed for the program, but you will (probably) have to configure the external libraries again. The folder "msvc2k10" with 3 files belongs under "trunk".

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

hreintke

LS,

What I mostly do when I get these kind of errors is looking in the updates in the "makefile" on svn.
That lists all necessary sources and is kept up-to-date.

When I see additions or deletions I update my MSVC project accordingly.

Herman

Sarlock

Thanks for the suggestions, I'll try them later when I get some time to attempt it again.

There were several missing/mis-located files that I was able to intercept and place in the libraries, so I am making slow progress.  This one stumped me because it didn't refer to a missing file so I wasn't sure how to proceed.  Hopefully after this issue is resolved I can compile the program and then figure out how to include the .diff file and get back to drawing things :)
Current projects: Pak128 Trees, blender graphics

Dwachs

Quote from: Sarlock on February 22, 2013, 08:30:52 AM
Warning   1   warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification   C:\Program Files (x86)\Simutrans\source code\LINK   Simutrans
Error   2   error LNK2001: unresolved external symbol "void __cdecl export_gui(struct SQVM *)" (?export_gui@@YAXPAUSQVM@@@Z)   C:\Program Files (x86)\Simutrans\source code\export_objs.obj   Simutrans
Error   3   error LNK1120: 1 unresolved externals   C:\Program Files (x86)\Simutrans\source code\Debug\Simutrans.exe   1   1   Simutrans
Please report these errors in the 'Bug reports' section, as these are omissions in the project file.
Parsley, sage, rosemary, and maggikraut.

Max-Max

Hi,

I have downloaded all teh libraries, checked out the trunk from SVN and I added the include and lib paths to the solution.
However, When I build, I get 14 errors and 9 warnings.

Warning   1   warning C4244: 'argument' : conversion from 'sint64' to 'const sint32', possible loss of data   D:\Projects\simutrans\dings\leitung2.cc   514   1   Simutrans
Warning   2   warning C4244: 'argument' : conversion from 'sint64' to 'const sint32', possible loss of data   D:\Projects\simutrans\dings\leitung2.cc   615   1   Simutrans
Warning   3   warning C4244: 'argument' : conversion from 'sint64' to 'const sint32', possible loss of data   D:\Projects\simutrans\dings\leitung2.cc   726   1   Simutrans
Warning   4   warning C4244: 'argument' : conversion from 'float' to 'const int', possible loss of data   D:\Projects\simutrans\gui\welt.cc   364   1   Simutrans
Warning   5   warning C4244: 'argument' : conversion from 'float' to 'const int', possible loss of data   D:\Projects\simutrans\gui\welt.cc   368   1   Simutrans
Warning   6   warning C4244: 'argument' : conversion from 'const sint64' to 'sint32', possible loss of data   D:\Projects\simutrans\player\simplay.cc   136   1   Simutrans
Warning   7   warning C4244: 'return' : conversion from 'sint64' to 'sint32', possible loss of data   D:\Projects\simutrans\player\simplay.cc   455   1   Simutrans
Warning   8   warning C4244: 'argument' : conversion from 'uint16' to 'uint8', possible loss of data   D:\Projects\simutrans\simworld.cc   2474   1   Simutrans
Warning   9   warning C4244: 'argument' : conversion from 'double' to 'const uint32', possible loss of data   D:\Projects\simutrans\simworld.cc   3007   1   Simutrans
Error   10   error LNK2001: unresolved external symbol "unsigned char __cdecl script_api::get_ribi(struct SQVM *,int)" (?get_ribi@script_api@@YAEPAUSQVM@@H@Z)   D:\Projects\simutrans\api_tiles.obj   Simutrans
Error   11   error LNK2001: unresolved external symbol "int __cdecl script_api::push_ribi(struct SQVM *,unsigned char)" (?push_ribi@script_api@@YAHPAUSQVM@@E@Z)   D:\Projects\simutrans\api_tiles.obj   Simutrans
Error   12   error LNK2001: unresolved external symbol "public: enum waytype_t __thiscall weg_besch_t::get_finance_waytype(void)const " (?get_finance_waytype@weg_besch_t@@QBE?AW4waytype_t@@XZ)   D:\Projects\simutrans\bruecke.obj   Simutrans
Error   13   error LNK2001: unresolved external symbol "void __cdecl export_simple(struct SQVM *)" (?export_simple@@YAXPAUSQVM@@@Z)   D:\Projects\simutrans\export_objs.obj   Simutrans
Error   14   error LNK2001: unresolved external symbol "public: __int64 __thiscall finance_t::get_maintenance_with_bits(enum transport_type)const " (?get_maintenance_with_bits@finance_t@@QBE_JW4transport_type@@@Z)   D:\Projects\simutrans\money_frame.obj   Simutrans
Error   15   error LNK2001: unresolved external symbol "public: void __thiscall finance_t::calc_finance_history(void)" (?calc_finance_history@finance_t@@QAEXXZ)   D:\Projects\simutrans\money_frame.obj   Simutrans
Error   16   error LNK2001: unresolved external symbol "public: void __thiscall finance_t::update_assets(__int64,enum waytype_t)" (?update_assets@finance_t@@QAEX_JW4waytype_t@@@Z)   D:\Projects\simutrans\simplay.obj   Simutrans
Error   17   error LNK2001: unresolved external symbol "public: static enum transport_type __cdecl finance_t::translate_waytype_to_tt(enum waytype_t)" (?translate_waytype_to_tt@finance_t@@SA?AW4transport_type@@W4waytype_t@@@Z)   D:\Projects\simutrans\simplay.obj   Simutrans
Error   18   error LNK2001: unresolved external symbol "public: void __thiscall finance_t::set_assets(__int64 const (&)[11])" (?set_assets@finance_t@@QAEXAAY0L@$$CB_J@Z)   D:\Projects\simutrans\simplay.obj   Simutrans
Error   19   error LNK2001: unresolved external symbol "public: void __thiscall finance_t::rdwr(class loadsave_t *)" (?rdwr@finance_t@@QAEXPAVloadsave_t@@@Z)   D:\Projects\simutrans\simplay.obj   Simutrans
Error   20   error LNK2001: unresolved external symbol "public: void __thiscall finance_t::new_month(void)" (?new_month@finance_t@@QAEXXZ)   D:\Projects\simutrans\simplay.obj   Simutrans
Error   21   error LNK2001: unresolved external symbol "public: __thiscall finance_t::finance_t(class spieler_t *,class karte_t *)" (??0finance_t@@QAE@PAVspieler_t@@PAVkarte_t@@@Z)   D:\Projects\simutrans\simplay.obj   Simutrans
Error   22   error LNK2001: unresolved external symbol "public: bool __thiscall finance_t::is_bancrupted(void)const " (?is_bancrupted@finance_t@@QBE_NXZ)   D:\Projects\simutrans\simworld.obj   Simutrans
Error   23   error LNK1120: 13 unresolved externals   D:\Projects\simutrans\Release\Simutrans.exe   Simutrans


As you can see, the the Linker is complainnig about function names that doesn't exist. I have done a solution wide search for these functions and they don't seem to be anywhere.

I'm using VC2013 Express. Has someone managed to build this solution?!?

PS. Who came up with the brilliant idea to mix files and function names in German/English for an international open project?!? :P
- My code doesn't have bugs. It develops random features...

Ters

Looks like player/finance.cc hasn't been added to the project.

Quote from: Max-Max on April 07, 2013, 04:06:33 PM
PS. Who came up with the brilliant idea to mix files and function names in German/English for an international open project?!? :P

The alternative would have been to have it all in German. Simutrans was born a German, but is slowly becomming English to open up for international developers, hence the mix. The progress is slow, in part because translation is rather boring and in itself unproductive, unlike bug hunting and making new features. And in part because a massive (automated) translation could ruin the code, or at best make it unrecognizable to seasoned developers. It's a chicked and egg scenario, the German code restricts the number of developers, and the low number of developers restrict the speed of translation.

IgorEliezer

Quote from: Ters on April 07, 2013, 04:38:53 PMIt's a chicken and egg scenario, the German code restricts the number of developers, and the low number of developers restrict the speed of translation.
Yep. Once in a while, some people submit patches that translate parts of code, but it's a slow process for the reasons that Ters already pointed out, the developers need to agree on terminologies and styles that are used throughout the code.

But still, feel free to ask for support. Depending on the case, it could be a new reason to translate more parts of the code.

Max-Max

Thank you for the quick response.

Yes, the player/finance.cc was missing from the project, but there are still some unresolved links left. I also found out that script/api/api_simple.cc was also missing in the project. I have to run away now but I need help to locate the last issue...

Error13   error LNK2001: unresolved external symbol "public: enum waytype_t __thiscall weg_besch_t::get_finance_waytype(void)const " (?get_finance_waytype@weg_besch_t@@QBE?AW4waytype_t@@XZ)   D:\Projects\simutrans\bruecke.obj   Simutrans

PS. The German/English comment was more an reflection when I browsed through the code =) I suspected it had started as a German project. Well as the Amercans say: We are converting to the metric system, Inch by Inch.... :)
- My code doesn't have bugs. It develops random features...

Dwachs

Parsley, sage, rosemary, and maggikraut.

Max-Max

Thank you, now it goes through the build process (Release) and I have copied the pthreads-w32-x-x-x-release dll's to the Release folder.

I'm running Win7 x64 and when I start my simutrans.exe a little dialog just flashes and nothing else happens.
If I start it from VC2013 Express The log shows that it can't find a bunch of DLL's...

'Simutrans.exe' (Win32): Loaded 'D:\Projects\simutrans\Release\Simutrans.exe'. Symbols loaded.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ws2_32.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nsi.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'D:\Projects\simutrans\Release\pthreadVC2.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr100.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\apphelp.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\AppPatch\AcLayers.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\userenv.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winspool.drv'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mpr.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'Simutrans.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll'


So I guessed that it needs the folder structure to work. I copied my simutrans.exe into my simutrans installation. It complained about pthreadVC2.dll not being present and there was a pthreadGC2.dll in the folder.

I copied over the pthreadVC2.dll and my simutrans.exe worked fine =)

Question:
Has pthreadGC2.dll been replaced by pthreadVC2.dll?
What is SDL.dll? It was not mentioned in the list of needed precompiled libraries and my new simutrans.exe works fine without it.

EDIT:
I was to fast to shout Hurray!! I managed to start my simutrans ONCE, thereafter I noticed that the config file had changed and after that I can't start my version of simutrans. I get the message: "The appllication was unable to start correctly (0xc000007b)..."

Is there some sensitive path information that has to be configured?
- My code doesn't have bugs. It develops random features...

VS

1) "Cannot find or open the PDB file" = can't debug code of that DLL. Note that the DLLs themselves were "Loaded", so that's all good...

2) pthread*C2.dll: G -> MingGW; V -> Microsoft (I think)

3) The config file - you mean settings.xml? It shouldn't contain any path information.

However!
You can easily debug your compiled simutrans without copying files and whatnot. Simply set in project properties / debugging (preferably for all configurations): command arguments "-use_workdir" and working directory [your normal Simutrans install]. See attached picture...

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Max-Max

I turned on the remote server PDB to get them and they all loads fine, just as you stated.
Unfortunately, simutrans crash before the debugger has any chance to stop the process (I start the debug process with F11, trace into).

After some sniffing around it seems like the error 0xc000007b is caused by a faulty image file. Some information also indicates that this problem may occurs when a 32bit application loads a 64bit DLL. But it is also said that Windows prevents a 32bit app to load any 64bit DLL:s...

I wonder if the pre-compiled library files are up to date or incompatible with this version of Simutrans. It seems like the Wiki isn't in synch with the current version (lots of broken pages) so I'm not sure if I have the right versions.

libbz2.zip - ‎2009-‎11-‎14 ‏‎21:01
openttd-useful-4.2-win.zip
pthreads-w32-2-9-1-release.zip

Is there any reason to not have the pre-compiled libraries in the repository, or include the source for them as sub projects?

I have the full license of GarageGames's Torque 2D and 3D engines and they have included all the source for the external libraries matching the game engine version. It works as a charm!
- My code doesn't have bugs. It develops random features...

prissi

Licence issues, as libaries are under different licence than simutrans. Furthermore, x64 programs can call 32 bit dlls on windows. Moreover, MSVC12 cannot even built 64 bit binaries. Was this changed in 13?

But most importantly for debugging:
Do NOT copy the executable. Set the simutrans main installation path in the debuggers as show by VS. Add "-debug 3 -use_workdir " as parameters. This should start a debugging session. I work like this all the time.

Markohs

In my experience is better to copy the executable and execute there when debugging.

I have a c:\simutrans folder with a normal simutrans installation and all paks I require there, and in the project (right-click properties build events post-build events) I have:

copy "$(OutDir)\$(TargetFileName)" "c:\simutrans"

Then in "debugging", command I have : c:\simutrans\$(TargetFileName) and Working directory c:\simutrans

Works for me, as prissi said you can also add -debug, I don't use -workdir, because I copy it there.

Both prissi's option and mine should work with no problems.

I recently installed VS 2013 and I have no problems compiling, just had to disable linker/advanced/Image Has SafeException Handlers: NO . This is because my linked libraries (SDL, libz etc.. ), have been compiled using an older VS compiler (I downloaded most of them from the internet pre-built), if you compile yourself you should be able to use SAFESEH, but who cares.

EDIT: One last tip: If you are going to debug a lot I advise you do disable the pre-build event, that changes the version nomber and forces re-compiling a few files each time.

Max-Max

None of this helped. I start to believe that either I'm a complete idiot or that something is wrong with my installation. During my last post I hadn't slept for 20 hours. I will remove simutrans source and start over fresh, maybe even reinstall VC++.

I would be really happy if you guys could zip your project file and static libraries for me, so we can exclude them from the equation.
Thank you all, I really appreciate your patience with me...

PS. I was wrong, I had VC2012 not 2013, maybe I should install 2013 instead?
- My code doesn't have bugs. It develops random features...

Max-Max

I guess you never should underestimate the power of a good nights sleep!

I started over from scratch, added the missing files to the project, copied the DLL:s and updated the paths and now both Debug and Release works!!!

Thank you for all your help, I was starting to think I was a complete idiot and should change my trade... :P
- My code doesn't have bugs. It develops random features...


Ters

Quote from: Max-Max on April 08, 2013, 04:31:47 PM
Thank you for all your help, I was starting to think I was a complete idiot and should change my trade... :P

You must be new in the trade.

Markohs

 You might want to mention in your post, VS, that Simutrans allows now (from @6487)  making a simutrans executable with console support in Visual Studio, not just on minGW as it was before.

To do so just need to change project properties -> linker -> system -> Console(/SUBSYSTEM:CONSOLE) . It will run sightly slower(if there are many text lines going to be displayed), it's meant for debugging and diagnosing problems.  :)

Ters

Quote from: Markohs on April 30, 2013, 02:45:06 PM
It will run sightly slower(if there are many text lines going to be displayed), it's meant for debugging and diagnosing problems.  :)

In case somebody isn't aware of it, this is an issue with the Windows console. If output is redirected to a file, there is little to no noticable slowdown, but Simutrans logs to file by itself so there is little point in that. The slowdown is the cost of seeing the text live without having to install some tail program (which usually have issues of their own).

vzrenggamani

#75
Thanks...

OTW Download MSVC 2010 :)

SIMUTRANS INDONESIA WEBSITE  <<< Indonesia Simutrans Addons Center And Web
HOPE YOU UNDERSTAND MY ENGLISH

DrSuperGood

You will need to post the errors (not warnings) if you want help.

They can be caused by any of the following...
Missing installed SVN program to generate revision.h while trying to use automatic version pulling.
Missing one or more third-party dependant libraries to link against on the search path.
One or more third-party dependant libraries are not compatible with the compile/link configuration (were built in a different way or with different version of MSVC).
Trying to build POSIX server (there is a syntax error when using MSVC).
Allowing the linker to automatically build a manifest (this conflicts with the custom manifest Simutrans uses).

prissi

The minimum version is now MSVC 2010. If you really use that old version, then the project files are no completely compatible.

DrSuperGood

It is worth noting that you can get 2015 community edition free of charge now just by creating a Microsoft account and downloading it (warning, big download). However that will throw you a new error until you turn off "sized destructors" with a hidden compiler flag due to Simutrans code being incompatible with modern C++ standards. You may also need to rebuild dependant libraries. Once you deal with such issues I can assure you that it does build and function as expected.

Ters

Mine claims to have expired. The command line tools still work, though.

DrSuperGood

Quote
Mine claims to have expired. The command line tools still work, though.
You need to register it with your Microsoft account to get the activation licence otherwise it runs as a 30 day trial. Both the account (which you may already have one) and the registration process are free and fairly quick. The licence is only valid for private or small company commercial use, with larger companies needing to buy a liscence.

VS

I added a note saying that this is outdated. I leave it to you to decide what to do with this Jurrasic-era information these days.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

jamespetts

I note that the attachments for the correct versions of bzlib2 have gone; is it possible to resurrect these?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.