help with C++ and flex, error after flex
George Nychis <[email protected]> Mon, 30 Mar 2009 11:32:20 -0700 (PDT)
| Newsgroups | gmane.comp.gnu.utils |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <4f068811-07c9-4f99-a78f-6c6ef0fc1eec@r18g2000vbi.googlegroups.com> |
Hi all, I am trying to build an architecture simulator (http:// cva.stanford.edu/books/ppin/#sim) that uses flex with bison to generate some code. I'm not extremely familiar with either tool. It first uses flex to generate configlex.cpp from config.l: flex -Pconfig -oconfiglex.cpp config.l Here is config.l and configlex.cpp, respectively: http://pastebin.com/f746a6b77 http://pastebin.com/f598c894e Line 18 in config.l has: unsigned int configlineno = 1; After flex runs, configlex.cpp generates:extern int configlineno; // line 361 int configlineno = 1; // line 363unsigned int configlineno = 1; // line 493 This obviously creates a problem when it tries to build: config.l:18: error: conflicting declaration 'unsigned int configlineno' configlex.cpp:363: error: 'configlineno' has a previous declaration as 'int configlineno' Why does it generate both an int and an unsigned int? I would appreciate any feedback. Thanks! George