The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: Ves on October 28, 2015, 07:07:30 PM

Title: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: Ves on October 28, 2015, 07:07:30 PM
I have tried to compile now for a long time the latest Simutrans Experiemental versions, and everytime ive hitted this:

Quote from: MVSE - 2013
Error   232   error C2039: 'max' : is not a member of 'std'   C:\Users\Victor\Documents\GitHub\simutrans-experimental\simconvoi.cc   5061   1   Simutrans-Experimental
Error   235   error C2039: 'min' : is not a member of 'std'   C:\Users\Victor\Documents\GitHub\simutrans-experimental\simconvoi.cc   5081   1   Simutrans-Experimental
Error   237   error C2039: 'max' : is not a member of 'std'   C:\Users\Victor\Documents\GitHub\simutrans-experimental\simconvoi.cc   5082   1   Simutrans-Experimental

Ive usually solved it by commenting out the mentioned lines, but I always get bugs on departure time etc, which I higly suspects is because I comment that out.
What am I missing when compiling?

Im using windows 7
MVSE 2013

I have searched in the forum with no luck of any similar problems with no luck.
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: Dwachs on October 28, 2015, 08:14:03 PM
You could also add #include <algorithm> at the start of the file.
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: DrSuperGood on October 28, 2015, 08:33:26 PM
Those errors are produced because it cannot find standard C++ functions "max" and "min" which are part of the standard C++ API. The cause is a lack of an include.

#include <algorithm>

This should be placed at the top of the file along with all other includes.

In any case it looks like you are trying to build an older release version so it is probably fixed in newer branches.
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: Ves on October 28, 2015, 08:43:29 PM
QuoteIn any case it looks like you are trying to build an older release version so it is probably fixed in newer branches.
The sources are downloaded just hours ago, from this: https://github.com/jamespetts/simutrans-experimental/tree/devel-new (https://github.com/jamespetts/simutrans-experimental/tree/devel-new)

I will try to add this #include <algorithm> thanks!


edit:
Now it compiles both debug and release, however the program crashes whenever I try to select a pak to use.
I have taken the pak also from the latest development on james github, but it just crashes upon loading the pakset with no information. When loading the swedish pakset that Vladki had compiled in another thread, an error comes up:
QuoteFATAL ERROR: vehicle_reader_t::read_node() - Incompatible pak file version for Simutrans-Ex, number 1
Aborting etc....
It should be noted that both paksets worked when I had commented out those 'min' and 'max' lines in the Simconvoi.cc Any thoughts? :)
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: jamespetts on October 28, 2015, 10:19:31 PM
This is very odd indeed. Which branch are you using on Github? I ask because, in my code, lines 5061 and 5081 of simconvoi.cc are nowhere near any use of "min" or "max".
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: Ves on October 28, 2015, 10:29:17 PM
I have downloaded a snapshoot from devel-new as late as today. Unless there are some hidden github function that makes it download something else than exactly that devel-new branch.
Its line nr 5349, 5370 and 5371 in this file that cause the initial trouble: https://github.com/jamespetts/simutrans-experimental/blob/devel-new/simconvoi.cc (https://github.com/jamespetts/simutrans-experimental/blob/devel-new/simconvoi.cc)
I dont know why the lines read different at my compiler than on Github?
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: jamespetts on October 29, 2015, 12:24:28 AM
Hmm - perhaps we are looking in the wrong place. How did you compile the Makeobj with which you made the pakset?
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: Ves on October 29, 2015, 12:32:45 AM
I didnt compile the makeobj, I never managed to. Now the latest I keep getting Safeseh errors while trying to compile makeobj.
The paksets are the ones compiled and uploaded by vladki and Junna in some of the other topics.
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: jamespetts on October 29, 2015, 12:35:13 AM
Can you refer me to the specific pakset download that you are using?
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: Ves on October 29, 2015, 12:44:10 AM
This one: https://uran.webstep.net/~vladki/simutrans/pak128-sweden.zip (https://uran.webstep.net/~vladki/simutrans/pak128-sweden.zip)
(from this post: http://forum.simutrans.com/index.php?topic=14853.msg146590#msg146590 (http://forum.simutrans.com/index.php?topic=14853.msg146590#msg146590))
and the other one i this one: http://www.mediafire.com/download/xhdb9oa4hf4qbq1/Pak128.Britain-Ex-0.9.2J.rar (http://www.mediafire.com/download/xhdb9oa4hf4qbq1/Pak128.Britain-Ex-0.9.2J.rar)
(from this post: http://forum.simutrans.com/index.php?topic=14832.msg146542#msg146542 (http://forum.simutrans.com/index.php?topic=14832.msg146542#msg146542))
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: Junna on October 29, 2015, 01:15:03 AM
Well, I guess I can compile for you if you are using Windows.

Makeobj

http://www.mediafire.com/download/05mv22uo77mnu6g/Makeobj.rar

Up to date (as of posting) of Experimental devel-new

http://www.mediafire.com/download/n5dupcb0bcn90v5/simutrans.rar
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: Ves on October 29, 2015, 08:37:04 PM
QuoteWell, I guess I can compile for you if you are using Windows.
Thankyou, yes I am :-)
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: jamespetts on October 29, 2015, 10:23:26 PM
Hmm - those run for me. I am afraid that I am having trouble understanding what your problem might be, other than to note that I use MSVS Express 2012 rather than 2013 (I have no idea whether this is the issue, however).
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: Ves on November 15, 2015, 10:37:20 PM
Finally it managed to compile properly!

I made sure I was on the correct branch (Im highly suspecting that it infact was the old branch I got to my computer), and when it started to complain about the Max's and Min's, I added:
#include <algorithm>
at the start of the file and it works!

So, James, maybe you could add that permanently to the beginning of the file?
Title: Re: Max and Min is not a member of 'std' (Simconvoi.cc)
Post by: jamespetts on November 15, 2015, 10:39:58 PM
Done.