BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
586 stars 165 forks source link

Makefile for c++ produces error on make for g++ version 7.5 #312

Closed meemsbror closed 4 years ago

meemsbror commented 4 years ago

When running

bnfc --cpp -m -o sum-cpp Sum.cf &&  make -C sum-cpp  &&  echo "1 + 2 + 3" | sum-cpp/TestSum

As per the example in the README.md i get the following error

make: Entering directory '/sum-cpp'
g++ -g --ansi -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unneeded-internal-declaration -c Test.C
Test.C:50:3: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++11-compat]
   Exp *parse_tree = nullptr;
   ^~~
Test.C: In function ‘int main(int, char**)’:
Test.C:50:21: error: ‘nullptr’ was not declared in this scope
   Exp *parse_tree = nullptr;
                     ^~~~~~~
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-unneeded-internal-declaration’
Makefile:48: recipe for target 'Test.o' failed
make: *** [Test.o] Error 1
make: Leaving directory '/sum-cpp'

when running g++ version 7.5.

This was circumvented by manually editing the makefile either adding the option

-std=gnu++0x

or

-std=c++11

to CCFLAGS

andreasabel commented 4 years ago

Thanks for the report! This is #310 which is fixed on the development version. Please install from the master branch to get this fix: https://github.com/BNFC/bnfc#installing-the-development-version