https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87088
--- Comment #10 from miltonkbenjamin <miltonkbenjamin at verizon dot net> --- (In reply to Jonathan Wakely from comment #9) > You're still doing it wrong. > > As I already said, to include a file you should be using -include not > -Xpreprocessor. > > Stop using the -Xpreprocessor option to name a file for inclusion, that's > not what it does. I tried the -include filename option and it didn't seem to work: ===============================================================: C:\parser>cls C:\parser>win_flex --c++ --outfile=lex1.yy.cc flex1.l 'win_flex' is not recognized as an internal or external command, operable program or batch file. C:\parser>echo "1) *********************************************" "1) *********************************************" C:\parser>echo "2) *********************************************" "2) *********************************************" C:\parser>g++ -include iostream.h -Xpreprocessor "FlexLexer.h" lex1.yy.cc FlexLexer.h:64:21: error: 'yy_create_buffer' declared as a 'virtual' field yy_create_buffer( istream* s, int size ) = 0; ^~~~~~~ FlexLexer.h:64:3: error: expected ';' at end of member declaration yy_create_buffer( istream* s, int size ) = 0; ^~~~~~~~~~~~~~~~ FlexLexer.h:64:28: error: expected ')' before '*' token yy_create_buffer( istream* s, int size ) = 0; ^ FlexLexer.h:66:26: error: 'istream' has not been declared virtual void yyrestart( istream* s ) = 0; ^~~~~~~ FlexLexer.h:71:13: error: 'istream' has not been declared int yylex( istream* new_in, ostream* new_out = 0 ) ^~~~~~~ FlexLexer.h:71:30: error: 'ostream' has not been declared int yylex( istream* new_in, ostream* new_out = 0 ) ^~~~~~~ FlexLexer.h:79:31: error: 'istream' has not been declared virtual void switch_streams( istream* new_in = 0, FlexLexer.h:80:6: error: 'ostream' has not been declared ostream* new_out = 0 ) = 0; ^~~~~~~ FlexLexer.h:107:22: error: expected ')' before '*' token yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 ); FlexLexer.h:112:26: error: expected ';' at end of member declaration struct yy_buffer_state* yy_create_buffer( istream* s, int size ); FlexLexer.h:112:51: error: expected ')' before '*' token struct yy_buffer_state* yy_create_buffer( istream* s, int size ); FlexLexer.h:114:18: error: 'istream' has not been declared void yyrestart( istream* s ); FlexLexer.h:117:31: error: 'istream' has not been declared virtual void switch_streams( istream* new_in, ostream* new_out ); ^~~~~~~ FlexLexer.h:117:48: error: 'ostream' has not been declared virtual void switch_streams( istream* new_in, ostream* new_out ); ^~~~~~~ FlexLexer.h:128:50: error: 'istream' has not been declared void yy_init_buffer( struct yy_buffer_state* b, istream* s ); ^~~~~~~ FlexLexer.h:143:2: error: 'istream' does not name a type istream* yyin; // input source for default LexerInput ^~~~~~~ FlexLexer.h:144:2: error: 'ostream' does not name a type ostream* yyout; // output sink for default LexerOutput ^~~~~~~ In file included from <command-line>:31:0: ./iostream.h:1:0: fatal error: inter-module optimizations not implemented for C++ #include <iostream> compilation terminated. C:\parser>echo "3) *********************************************" "3) *********************************************"