On Tue, 10 Sep 2002, Alexandre Beneteau wrote: ... > lexer.ll: In member function `virtual int My_lily_lexer::yylex()': > lexer.ll:227: `cerr' undeclared (first use this function) > lexer.ll:227: (Each undeclared identifier is reported only once for each > function it appears in.)
.... > > Is anybody knowing c++ and flex can give a fix/patch ??? > Thanks in advance, > > I don't know exactly this (f)lex error. But because I spended some days (and nights) to make my program noteedit gcc-3.2 compatible I think I know from many problems I had what's wrong: In gcc-3.2 you cannot write: #include <iostream> main() { char word[128]; cout << "Say a word >>> "; cin >> word; cerr << "the word is " << word << endl; } The result is: $ g++ ctest.cc -o ctest ctest.cc: In function `int main()': ctest.cc:5: `cout' undeclared (first use this function) ctest.cc:5: (Each undeclared identifier is reported only once for each function it appears in.) ctest.cc:6: `cin' undeclared (first use this function) ctest.cc:7: `cerr' undeclared (first use this function) ctest.cc:7: `endl' undeclared (first use this function) Correct is either: #include <iostream> main() { char word[128]; std::cout << "Say a word >>> "; std::cin >> word; std::cerr << "the word is " << word << std::endl; } or: #include <iostream> using namespace std; main() { char word[128]; cout << "Say a word >>> "; cin >> word; cerr << "the word is " << word << endl; } ------ Furthermore: Some (f)lex' procduce the following declaration: extern int isatty(); This declaration differs from the declaration in "unistd.h". This is no problem in C. But the C++ compiler gets excited over this declaration difference. I found no other solution than to introduced the following suffix rule in Makefile: .ll.cc: $(LEX) -olex.yy.c $< sed '/extern *int *isatty/d' lex.yy.c > $@ rm lex.yy.c -- J.Anders, Chemnitz, GERMANY ([EMAIL PROTECTED]) _______________________________________________ Lilypond-user mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/lilypond-user