News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

Max and Min is not a member of 'std' (Simconvoi.cc)

Started by Ves, October 28, 2015, 07:07:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ves

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.

Dwachs

You could also add #include <algorithm> at the start of the file.
Parsley, sage, rosemary, and maggikraut.

DrSuperGood

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.

Ves

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

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? :)

jamespetts

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

Ves

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
I dont know why the lines read different at my compiler than on Github?

jamespetts

Hmm - perhaps we are looking in the wrong place. How did you compile the Makeobj with which you made the pakset?
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.

Ves

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.

jamespetts

Can you refer me to the specific pakset download that you are using?
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.


Junna


Ves

QuoteWell, I guess I can compile for you if you are using Windows.
Thankyou, yes I am :-)

jamespetts

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

Ves

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?

jamespetts

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.