Unable to resolve compilation error in c file, provided with the lex/yacc book by John Levine.
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Sorry, but if possible to see directly on cygwin, the details about: -lfl option for cc, which I hope is linker for flex.
I derived this (i.e., -lfl option for cc being for the linker) conclusion, as the response by @Nevem_Teve seems to point that the need for '-ll' (which I interpret as '-lfl' for flex) option for cc is obviated, if the yywrap() is specified in the lex file.
Please tell why the -lfl option, for cc in cygwin; is not needed, when add the stated yywrap(void) function, to the program.
Seems the -lfl option is for linker. If so, what role does it serve?
----
Want to add that have come across just now, that states something similar (as shown in the attachment).
But, want to delve more into details, than by the one-liner stated there (i.e., 'The -lfl option to gcc tells the linker to link the flex runtime library into the executable.'), i.e. to see how the linker operates.
---------
2. Want to add to my last line above, that am not helped by the details offered here (also, shown in the attachment) or 'even' here, but need some practical exercises that really take to that level. Some source (book, site) would be needed, unless something is offered 'directly' by your kind side.
Option `-ll` means: 'find and use libl.a (or libl.so, whichever comes first)', option `-lfl` means 'find and use libfl.a (or libfl.so)'.
`libl.a` belongs to the original `lex`, while `libfl.a` belongs to the replacement product `flex`.
Now the common part in these two is that you need neither of them.
Please tell if the lack of need of either of them, is due to including the yywrap() (and possibly other functions, though unneeded here). If yes, then please refer to some sources.
----
Also, request how to get help on cc (gcc) options as '-lfl' on cygwin terminal, as the below attachment shows that couldn't get it.
You have been given many documentation about gcc and ld, kindly read them. Also you can use command `man gcc`
`yywrap` is one of the functions you have to implement to get your lexical parser work. Resolving `yywrap` from an external library is a bad idea, even if it might occasionally work.
Off: if you wish to use Linux(ish subsystem) within Windows, use WSL1 with Ubuntu.
Off: `su`, `sudo`, `run` and other commands you tried in your Cygwin screenshot are completely off-topic.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.