Yacc and Lex inclusion confusion
Posted
by thejohnmeister
on Stack Overflow
See other posts from Stack Overflow
or by thejohnmeister
Published on 2010-03-21T05:52:38Z
Indexed on
2010/03/21
6:01 UTC
Read the original article
Hit count: 432
I am wondering how to correctly compile a program with a Makefile that has calls to yyparse in it?
This is what I do:
I have a Makefile that compiles all my regular files and they have no connections to y.tab.c or lex.yy.c (Am I supposed to have them?)
I do this on top of my code:
#include "y.tab.c"
#include "lex.yy.c"
#include "y.tab.h"
This is what happens when I try to make the program:
When I just type in "make", it gives me many warnings. Some of the examples are shown below.
In function yywrap':
/src/parser.y:12: multiple definition of
yywrap'
server.o
:/src/parser.y:12: first defined here
utils.o:
In function yyparse':
/src/y.tab.c:1175: multiple definition of
yyparse'
server.o:/src/y.tab.c:1175: first defined here
utils.o
I get many different errors referring to different yy_* files. I have compiled successfully with multiple calls to yyparse in the past, but this time seems to be different. It seems an awful lot like an inclusion problem somewhere but I can't tell what it is. All my header files have ifndef conditions, as well.
Thanks for your help!
© Stack Overflow or respective owner