Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I eliminate the 'main' routine of the flex & bison so I can put the lexing and parsing process into a library?

I'm working on a parser that parses json string and I want to make it a library. The problem is that when I use ld to link the library I wrote, there's a error message:

main.o: In function `main':
main.c:(.text+0x0): multiple definition of `main'
json-parser.o:/build/buildd/flex-2.5.35/libmain.c:29: first defined here

how can I fix this..? thanks.

like image 644
mapcan Avatar asked Jan 13 '11 13:01

mapcan


People also ask

How do I turn off Flex-basis?

If you want to delete flex-basis , you can use width or height instead. When specified on a flex item, the auto keyword retrieves the value of the main size property as the used flex-basis . And the main size property is given by width (in row layouts) or height (in column layouts):

How do I make my Fitbit Flex full width?

You can make flex items take the content width instead of the width of the parent container with CSS properties. The problem is that a flex container's initial setting is align-items: stretch; meaning that items expand to cover the container's full length along the cross axis.


1 Answers

using gcc -o charcount charcount.o -lfl instead of gcc -o charcount -lfl charcount.o may be help.

It's strange that the order of object file and shared library make crucial sense here, but the reversion really works.

like image 172
zhengchl Avatar answered Nov 07 '22 20:11

zhengchl