The International Simutrans Forum

 

Author Topic: [r8683] Won't compile because of issues with OVERRIDE keyword on macOS  (Read 545 times)

0 Members and 1 Guest are viewing this topic.

Offline WillysMD

  • *
  • Posts: 8
  • Languages: FR, EN, NL, ES
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
Code: [Select]
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).
Code: [Select]
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:
Code: [Select]
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.
« Last Edit: March 01, 2019, 11:36:22 PM by WillysMD »

Offline ACarlotti

  • *
  • Posts: 440
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.

Offline WillysMD

  • *
  • Posts: 8
  • Languages: FR, EN, NL, ES
I edited my first post to clarify

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2642
  • Languages: EN
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.

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 307
  • Languages: JP,EN
I'm using mac. For me, just adding
Code: [Select]
FLAGS = -std=c++11to 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.

Offline WillysMD

  • *
  • Posts: 8
  • Languages: FR, EN, NL, ES
I'm using mac. For me, just adding
Code: [Select]
FLAGS = -std=c++11to 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?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4568
  • Languages: EN, DE, AT
I reverted the change to simtypes, missing override feature should not be treated as compile error.