The International Simutrans Forum

 

Author Topic: Cannot compile Simutrans Extended  (Read 1296 times)

0 Members and 1 Guest are viewing this topic.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Cannot compile Simutrans Extended
« on: July 05, 2020, 04:04:06 PM »
1>C:\Users\Bonne\Downloads\simutrans-extended-master\simutrans-extended-master\utils\simthread.h(34,10): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory (compiling source file gui\tool_selector.cc)
1>Done building project "Simutrans-Extended.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Even though the that pthread,h file is there. I don't know what to do. Please help!

Online Ranran

  • Devotee
  • *
  • Posts: 1160
  • Languages: ja
Re: Cannot compile Simutrans Extended
« Reply #1 on: July 05, 2020, 04:17:15 PM »
I also remember struggling with such an error at first.
It's a long time ago, so there are some vague points in my memory.

pthread.h must be in utils/openttd folder.

I'm sorry for the Japanese screen, but in the case of MSVC I think that I had to change it according to my environment on the right side of this screen.


I mean, set the path correctly on the property.
« Last Edit: July 05, 2020, 04:33:07 PM by Ranran »

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #2 on: July 05, 2020, 07:29:41 PM »
It is in the utilities folder yet it still can't read it. And the Japanese is fine. If you have the same 2019 version mine should match up with yours and I can just use mine as a reference.

Here is my source code: C:\Users\Bonne\Downloads\simutrans-extended-master\simutrans-extended-master\utils\openttd

edit: Just doubled checked and it is not in that folder. Sorry, I will move it there and see if it works.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #3 on: July 05, 2020, 07:45:07 PM »
I transferred it to the folder but it's still saying that it can't find that file. I just might leave Simutrans as is and forget about converting units from metric to us for now and come back to it another time. Thank you for your help by the way.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 386
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #4 on: July 06, 2020, 12:42:11 AM »
If you put your changes on github, I could try to compile it on my machine to see if it works

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #5 on: July 06, 2020, 03:21:49 PM »
Thank you. That will be a big help. If you can't get it can you tell me what I did wrong?

Here's the link:
https://github.com/MasterJedi1996/TheRoadmaster1996-Simutrans-Extended-Source-Codes-U.S.-Units

It is a 7zip so I can get it uploaded under the 150MB limit.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 386
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #6 on: July 07, 2020, 12:01:59 AM »
Thank you. That will be a big help. If you can't get it can you tell me what I did wrong?

Here's the link:
https://github.com/MasterJedi1996/TheRoadmaster1996-Simutrans-Extended-Source-Codes-U.S.-Units

It is a 7zip so I can get it uploaded under the 150MB limit.
This isn't quite what I meant by put it on github! usually we create a fork of the original. either way i am looking into it now...

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #7 on: July 07, 2020, 02:15:40 AM »
Oh sorry. I'm new to all of this (adding stuff to github that is) and not that tech savvy to begin with so I'm not that familiar with those kinds of terms. And thank you for your help. You don't know what a headache it has been trying to figure out what's wrong even though it looks fine.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 386
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #8 on: July 07, 2020, 02:52:04 AM »
I found a problem: you redefined some functions as yards, then tried to call them as feet. In effect, you were trying to call functions that did not exist. Yards in particular are problematic because the code already uses internal units called yards (which are not equivalent to imperial yards). I understand this is a test at this stage. Are you new to c++? If so, I would probably not pursue this change right now. If not, carry on but it will only get more complicated.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #9 on: July 07, 2020, 02:05:39 PM »
Okay thank you. If I change the yards to feet will that work? (I did mess up when changing it from meters. It should have been feet.) And I would like to try it.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 386
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #10 on: July 07, 2020, 03:03:48 PM »
Okay thank you. If I change the yards to feet will that work? (I did mess up when changing it from meters. It should have been feet.) And I would like to try it.
You'd have to go back to before you made the change, otherwise you'd have no way to distinguish what was originally yards with what was originally meters. Changing the names of functions will work so long as it's done consistently. Of course this has no effect on its own.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #11 on: July 07, 2020, 03:27:59 PM »
What do you mean? Are you saying that I'll have to change say if 1 tile is 1000 meters or such? That shouldn't be difficult.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 386
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #12 on: July 07, 2020, 04:20:33 PM »
What do you mean? Are you saying that I'll have to change say if 1 tile is 1000 meters or such? That shouldn't be difficult.
Unfortunately the way the code is set up makes it extremely difficult if you wish to actually convert the units and keep both systems as options. If you simply want to display "mph" in place of "km/h", but using km/h as the actual hidden unit, you would need to go through the translation texts and any string that are used to display texts. a search-and-replace would change parts of the code you didn't intend to change.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #13 on: July 07, 2020, 06:32:55 PM »
That's the thing. I dont want both I just want US units instead of metric in the game is all.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #14 on: July 08, 2020, 02:52:32 AM »
I got one more shot at this. I want to ask you something freddyhayward, where did you put the pthread.h file? Is it in the Openttd folder?


Offline freddyhayward

  • Devotee
  • *
  • Posts: 386
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #15 on: July 08, 2020, 03:53:50 AM »
I got one more shot at this. I want to ask you something freddyhayward, where did you put the pthread.h file? Is it in the Openttd folder?
I didn't move pthread.h at all; i moved plainstring.h from the main folder into the utils folder.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #16 on: July 08, 2020, 01:50:29 PM »
Well, that's it then. I officially give up and will leave Simutrans as it is. I have done all I could with the resources available and I've even asked the online community for help and you guys have provided and I still cannot get it. It is simply not to be. Thank you guys for your help.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #17 on: July 21, 2020, 09:54:30 PM »
Can I check - are you able to compile Simutrans-Extended before you have made any changes to the code? I note that you are unable to compile, but that others have pointed out that you have made changes that do not seem to relate to the issue that you are having with compiling.

May I ask whether you are familiar with how to set up code to compile? The error that you report suggests that you have not installed the necessary header files on which Simutrans-Extended relies (in this case, pthreads, the which deals with multi-threading). You need to install header file/library file combinations for quite a few libraries on which Simutrans-Extended relies, including pthreads for multi-threading, libpng for graphics, zlib for compression and a few others. There are guides for this already on the forum, I belive - have you looked at those?

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #18 on: July 21, 2020, 09:59:05 PM »
No I have not. Where can I find those. Are they on this form or do I need to install them else where

Online Ranran

  • Devotee
  • *
  • Posts: 1160
  • Languages: ja

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #20 on: July 21, 2020, 10:35:05 PM »
Oh, it's this topic. I should have known. Thank you.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #21 on: July 21, 2020, 10:57:45 PM »
OK. So I tried compiling the game with out changing anything and it still fails saying that it cannot open libbz2.lib. The pthread error went away so that's progress!

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #22 on: July 21, 2020, 11:14:40 PM »
OK. So I tried compiling the game with out changing anything and it still fails saying that it cannot open libbz2.lib. The pthread error went away so that's progress!

Excellent - you now need to install and configure the header/library files for libbz2 (a .lib file is a library file, so you need to make sure that libbz2.lib is in one of the folders that Visual Studio is configured to check for library files) to overcome this error.

It is always best to try to compile the code without making any changes before trying to change anything in the code.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #23 on: July 21, 2020, 11:24:30 PM »
OK. Again where can I find it because I looked and it's nowhere.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #24 on: July 21, 2020, 11:27:18 PM »
OK. Again where can I find it because I looked and it's nowhere.

Does the link in the thread to which Ranran posted a link above not work?

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #25 on: July 22, 2020, 12:04:11 AM »
It does, and I have used that topic many times but it dose not provide the libbz2.lib.

Online Ranran

  • Devotee
  • *
  • Posts: 1160
  • Languages: ja
Re: Cannot compile Simutrans Extended
« Reply #26 on: July 22, 2020, 12:09:16 AM »
You have to prepare different ones for 32bit and 64bit, so I think it may be necessary to separate folders.
I wonder if that is the reason why it is not provided in one package.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #27 on: July 22, 2020, 12:34:39 AM »
Can you clarify Ran? I don't understand what you mean.

Online Ranran

  • Devotee
  • *
  • Posts: 1160
  • Languages: ja
Re: Cannot compile Simutrans Extended
« Reply #28 on: July 22, 2020, 12:48:16 AM »
I think libbz2 is provided for win32 and win64. You need to download them and set the library directory correctly.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #29 on: July 22, 2020, 01:51:27 AM »
So do I need to download both versions?

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #30 on: July 22, 2020, 10:31:25 AM »
So do I need to download both versions?

No - you need to download the 32-bit version if you are compiling a 32 bit executable or a 64-bit version if you are compiling a 64-bit executable. You only need to download both if you are compiling both types.

Simutrans-Extended is best compiled as a 64-bit executable, since the larger games run out of memory when compiled as 32-bit executables. You need to make sure that all your libraries are the 64-bit versions, or else you will not be able to compile the executable.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #31 on: July 22, 2020, 01:48:00 PM »
I see. I've always done 64-bit seeing that that is what my laptop runs. Still, I'll bet something is wrong with the version I download. I don't know at this point I'm not worried about changing over. I'm just going to leave Simutrans as is and move on. I would like to add another horse or two and then an eighteen wheeler, plus a bus and then move on to railroads. I would like to have an older locomotive from the 1830s, an older Civil War era locomotive, a newer 1930s '40s era and then a modern day locomotive. Then a boat, a plane, some houses, factories, signals and stations and then I will be ready to post the first version of my pakset.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #32 on: August 17, 2020, 07:21:56 PM »
So what if the reason I'm having trouble is because I'm using the newest version of visual studio? Should I try an earlier version what version does everyone else use?

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #33 on: August 17, 2020, 10:43:04 PM »
So what if the reason I'm having trouble is because I'm using the newest version of visual studio? Should I try an earlier version what version does everyone else use?

Which version are you using? Using a newer version should not by itself prevent you from being able to compile the code.

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #34 on: August 17, 2020, 10:50:23 PM »
I was using the 2017 version. The guide I was using said to use 2015. So my thought was that for the newer version it required more stuff then the older one. That was my theory.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #35 on: August 17, 2020, 10:53:44 PM »
I was using the 2017 version. The guide I was using said to use 2015. So my thought was that for the newer version it required more stuff then the older one. That was my theory.

I use the 2017 version myself, so this will not be the cause of your problem. Did you get anywhere with checking that you were using the 64 bit versions of the libraries?

Online TheRoadmaster1996

  • *
  • Posts: 222
  • Languages: EN, some ES
Re: Cannot compile Simutrans Extended
« Reply #36 on: August 17, 2020, 10:55:44 PM »
No I did not. Maybe I just need to re-download Visual Studio but I'm not worried about changing, I was just thinking out loud.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Cannot compile Simutrans Extended
« Reply #37 on: August 17, 2020, 11:41:57 PM »
No I did not. Maybe I just need to re-download Visual Studio but I'm not worried about changing, I was just thinking out loud.

If you want to be able to compile Simutrans-Extended, you would do well to investigate the libraries as I suspect that that is where the difficulties that you have been having are likely to lie.

Online Ranran

  • Devotee
  • *
  • Posts: 1160
  • Languages: ja
Re: Cannot compile Simutrans Extended
« Reply #38 on: August 18, 2020, 03:33:02 AM »
I am using MSVC 2017. Because 2015 was already unavailable for download.