Skip to content

RTS header files can't be used with a C++ compiler

If you compile m1.cpp:

#include "Rts.h"
int main(int argc, char** argv) {
}

with:

g++ -g m1.cpp -std=c++11 -I includes/ -c

you get:

In file included from includes/Rts.h:29:0,
                 from m1.cpp:1:
includes/Stg.h:29:3: error: #error __STDC_VERSION__ does not advertise C99 or later
 # error __STDC_VERSION__ does not advertise C99 or later
   ^

It's not advertised anywhere that it should work, but it used to work. https://phabricator.haskell.org/D2045 is what introduced this check.

Judging by https://stackoverflow.com/questions/48045243/ghc-gcc-compiler-issue-stdc-version-w-c99-from-stg-h-fails-for-every-packa, it affects GHC 8.2 and later.

Trac metadata
Trac field Value
Version
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC hvr, simonmar
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information