News:

SimuTranslator
Make Simutrans speak your language.

[r8683] Won't compile because of issues with OVERRIDE keyword on macOS

Started by WillysMD, March 01, 2019, 09:48:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WillysMD

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.

ACarlotti

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.


DrSuperGood

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.

THLeaderH

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.

WillysMD

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?

Dwachs

I reverted the change to simtypes, missing override feature should not be treated as compile error.
Parsley, sage, rosemary, and maggikraut.