The International Simutrans Forum

Development => Technical Documentation => Topic started by: WillysMD on March 01, 2019, 09:48:43 PM

Title: [r8683] Won't compile because of issues with OVERRIDE keyword on macOS
Post by: WillysMD on March 01, 2019, 09:48:43 PM
Hi,

I haven't been using simutrans for a while but the other day I wanted to compile the lastest revision, but it failed because of an issue related to the override keyword.
I was getting the error message added in r8683
Override required!

I did some digging and found out that the default g++ version that comes with XCode is outdated and thus doesn't support C++11 features.
So I installed gcc 7 with brew and added this line to my configuration to use it (having little experience with makefiles, I'm not sure this is correct).
CXX = /usr/local/bin/g++-7

This first error was gone, but now the compiler couldn't find SDL2 headers and I got the following error message:
SDL2/SDL.h: No such file or directory

I tried playing around with the SDL settings in the makefile without much success.
From what I understand, by default it's looking for them in ~/Library/Frameworks/SDL.framework, which I have, but I was trying to change it to include the files from brew's SDL install in /usr/local/Cellar/sdl/.

If someone handy with compilation on mac could give me a hint, that would be very much appreciated.
Title: Re: [r8683] Won't compile because of issues with OVERRIDE keyword on macOS
Post by: ACarlotti on March 01, 2019, 11:17:35 PM
Quote from: WillysMD on March 01, 2019, 09:48:43 PM
it failed because of an issue related to the override keyword.
Quote
But now the compiler can't find SDL2 headers.

Can you show us exactly what output or error messages you are seeing? And whether you're still getting the first issue or not? Without that it will be very hard for anyone to work out what is going wrong.
Title: Re: [r8683] Won't compile because of issues with OVERRIDE keyword on macOS
Post by: WillysMD on March 01, 2019, 11:36:47 PM
I edited my first post to clarify
Title: Re: [r8683] Won't compile because of issues with OVERRIDE keyword on macOS
Post by: DrSuperGood on March 02, 2019, 01:25:21 AM
The requirement of the override feature is by design. For some reason Prissi wants to lock out older compilers which do not support override possibly because of a misunderstanding as to what override does. As far as I am aware there is no reason for this lockout and it was still largely an on going discussion. In any case revert the changes made by R8683 and it should compile again without the override keyword.

One needs SDL2 libraries to build with SDL2. Older versions uses to have SDL1 support, so it is important that one change/upgrade the libraries to SDL2.
Title: Re: [r8683] Won't compile because of issues with OVERRIDE keyword on macOS
Post by: THLeaderH on March 02, 2019, 05:02:43 AM
I'm using mac. For me, just adding
FLAGS = -std=c++11
to config.default solves this issue.
Since override keyword is supported from c++11, you have to declare the C++ version when you compile the code.
Title: Re: [r8683] Won't compile because of issues with OVERRIDE keyword on macOS
Post by: WillysMD on March 04, 2019, 08:50:08 PM
Quote from: THLeaderH on March 02, 2019, 05:02:43 AM
I'm using mac. For me, just adding
FLAGS = -std=c++11
to config.default solves this issue.

Indeed it worked, I was thrown off by the weird versioning of macOS compilers...
Maybe it should be considered to be added upstream?
Title: Re: [r8683] Won't compile because of issues with OVERRIDE keyword on macOS
Post by: Dwachs on March 05, 2019, 04:23:24 PM
I reverted the change to simtypes, missing override feature should not be treated as compile error.