linking error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sana24
    New Member
    • Sep 2006
    • 17

    #16
    Originally posted by Banfa
    which tyreId has already addressed in this post.

    basically it can't locate it because you haven't written it.
    But this code work well on linux. The problem on linux we use the option -lfl in the link. But on windows i don't know a flex library.
    I want to link files generated by flex and bison on visual studio C++.
    but i have this error:
    vhdl.obj : error LNK2001: unresolved external symbol _yylex
    I think that there is a flex library missed. But i don't find a win32 version of flex library.
    Can you please help me

    Comment

    • tyreld
      New Member
      • Sep 2006
      • 144

      #17
      I'm at a lost as how that code would work on Linux. Linking against the Flex library doesn't provide a magical yylex implementation. If it did that would mean some how the Flex library just happens to know what tokens need to be recognized in your VHDL language. You are responsible for writing a lexical specification that contains the definitions of the tokens the lexer needs to recogonize. From this specification Flex generates C code. This C code contains an implementation of yylex. The Flex library only provides a main method that allows you to test a lexer you've defined against some input on stdin. I can only assume at some point in porting this application to Windows you neglected to include the lexer specification file used by Flex to generate the lexer code.

      Comment

      • sana24
        New Member
        • Sep 2006
        • 17

        #18
        Originally posted by tyreld
        I'm at a lost as how that code would work on Linux. Linking against the Flex library doesn't provide a magical yylex implementation. If it did that would mean some how the Flex library just happens to know what tokens need to be recognized in your VHDL language. You are responsible for writing a lexical specification that contains the definitions of the tokens the lexer needs to recogonize. From this specification Flex generates C code. This C code contains an implementation of yylex. The Flex library only provides a main method that allows you to test a lexer you've defined against some input on stdin. I can only assume at some point in porting this application to Windows you neglected to include the lexer specification file used by Flex to generate the lexer code.
        I have three files:
        lexx.yy.c generated by flex from vhdl.l
        vhdl.c generated by bison from vhdl.y
        main.c application to use the parser
        on linux i havn't error, in fact flex and bison are installed on linux.
        but i d'ont find a version of flex and bison on win32, just flex.exe and bison.exe to generate c files.
        How can i include the lexer specification file used by Flex to generate the lexer code,
        please it's very urgent to run this application on windows

        Comment

        • tyreld
          New Member
          • Sep 2006
          • 144

          #19
          I've never used flex or bison on windows. It sounds like bison is generating a vhdl.c. Is flex on windows generating lex.yy.c?

          Comment

          • sana24
            New Member
            • Sep 2006
            • 17

            #20
            Originally posted by tyreld
            I've never used flex or bison on windows. It sounds like bison is generating a vhdl.c. Is flex on windows generating lex.yy.c?
            yes it generates lex.yy.c

            Comment

            • tyreld
              New Member
              • Sep 2006
              • 144

              #21
              Okay, is lex.yy.c being compiled into lex.yy.o? If so, is lex.yy.o being included in as a necessary object file at link time?

              Comment

              • sana24
                New Member
                • Sep 2006
                • 17

                #22
                Originally posted by tyreld
                Okay, is lex.yy.c being compiled into lex.yy.o? If so, is lex.yy.o being included in as a necessary object file at link time?
                yes lex.yy.c is compiled into lex.yy.o, but i don't include it in the link.

                Comment

                • sana24
                  New Member
                  • Sep 2006
                  • 17

                  #23
                  Originally posted by tyreld
                  Okay, is lex.yy.c being compiled into lex.yy.o? If so, is lex.yy.o being included in as a necessary object file at link time?
                  yes lex.yy.c is compiled into lex.yy.o, but i don't include it in the link.
                  Is it the problem?

                  Comment

                  • sana24
                    New Member
                    • Sep 2006
                    • 17

                    #24
                    Originally posted by sana24
                    yes lex.yy.c is compiled into lex.yy.o, but i don't include it in the link.
                    Is it the problem?
                    i include the lex.yy.o in the link but I still have the same error:
                    vhdl.obj: unresolved extern symbol_yylex

                    Comment

                    • laydner
                      New Member
                      • Oct 2006
                      • 1

                      #25
                      Hi,

                      this link may help you..

                      http://clemens.byteham mer.com/papers/FlexTutorial/flex-vs_tutorial.htm l

                      Comment

                      Working...