help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help with C++ and flex, error after flex


From: George Nychis
Subject: help with C++ and flex, error after flex
Date: Mon, 30 Mar 2009 11:32:20 -0700 (PDT)
User-agent: G2/1.0

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]