Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6076769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:38:44+00:00 2026-05-23T10:38:44+00:00

I’m running into some linker errors with flex when I try compiling the resulting

  • 0

I’m running into some linker errors with flex when I try compiling the resulting scanner with g++. If I give flex the following (very simple) script:

%%
.  ECHO;

Then run flex as

flex++ scanner.l 

And then try compiling the resulting code as

g++ lex.yy.cc -ll

I get the following errors:

/tmp/ccD5WdY3.o:(.rodata._ZTV11yyFlexLexer[vtable for yyFlexLexer]+0x28): undefined reference to `yyFlexLexer::yywrap()'
/usr/lib/libl.a(libmain.o): In function `main':
/build/buildd/flex-2.5.35/libmain.c:30: undefined reference to `yylex'
collect2: ld returned 1 exit status

I’m not sure why this is. Am I linking in the wrong library with -ll? If so, what should I do to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:38:45+00:00Added an answer on May 23, 2026 at 10:38 am

    As you mentioned, I think -ll is unnecessary.
    Probably libl contains the code like the following:

    int main() { return yylex(); }
    

    However, the scanner code generated by flex++ doesn’t contain free-standing
    function yylex.
    So if the scanner is linked with the above main, it cannot find yylex.
    When the scanner is generated by flex++, that scanner needs a dedicated main
    instead of linking with -ll, and the simplest main will be like the following:

    int main() {
      for ( yyFlexLexer l; l.yylex(); ) {}
    }
    

    As for the usage of C++ scanner,
    this part
    of flex document will help.

    That being said, as the document says:

    the present form of the scanning class
    is experimental and may change
    considerably between major releases

    I cannot recommend using C++ scanner positively.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am currently running into a problem where an element is coming back from
I have a French site that I want to parse, but am running into
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.