News:

Beta test the new forum at https://simutrans.forum/
Want to praise Simutrans?
Your feedback is important for us ;D.

Cannot compile Simutrans Extended

Started by RealAmerican1776, July 05, 2020, 04:04:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RealAmerican1776

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!

Ranran

#1
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.

RealAmerican1776

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.

RealAmerican1776

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.

freddyhayward

If you put your changes on github, I could try to compile it on my machine to see if it works

RealAmerican1776

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.

freddyhayward

Quote from: TheRoadmaster1996 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.
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...

RealAmerican1776

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.

freddyhayward

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.

RealAmerican1776

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.

freddyhayward

Quote from: TheRoadmaster1996 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.
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.

RealAmerican1776

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.

freddyhayward

Quote from: TheRoadmaster1996 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.
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.

RealAmerican1776

That's the thing. I dont want both I just want US units instead of metric in the game is all.

RealAmerican1776

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?


freddyhayward

Quote from: TheRoadmaster1996 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?
I didn't move pthread.h at all; i moved plainstring.h from the main folder into the utils folder.

RealAmerican1776

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.

jamespetts

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?
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.

RealAmerican1776

No I have not. Where can I find those. Are they on this form or do I need to install them else where


RealAmerican1776

Oh, it's this topic. I should have known. Thank you.

RealAmerican1776

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!

jamespetts

Quote from: TheRoadmaster1996 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!

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.
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.

RealAmerican1776

OK. Again where can I find it because I looked and it's nowhere.

jamespetts

Quote from: TheRoadmaster1996 on July 21, 2020, 11:24:30 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?
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.

RealAmerican1776

It does, and I have used that topic many times but it dose not provide the libbz2.lib.

Ranran

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.

RealAmerican1776

Can you clarify Ran? I don't understand what you mean.

Ranran

I think libbz2 is provided for win32 and win64. You need to download them and set the library directory correctly.

RealAmerican1776

So do I need to download both versions?

jamespetts

Quote from: TheRoadmaster1996 on July 22, 2020, 01:51:27 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.
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.

RealAmerican1776

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.

RealAmerican1776

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?

jamespetts

Quote from: TheRoadmaster1996 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?

Which version are you using? Using a newer version should not by itself prevent you from being able to compile the code.
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.

RealAmerican1776

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.