Undefined Reference To yywrap

后端 未结 5 1484
后悔当初
后悔当初 2020-12-07 22:10

I have a simple \"language\" that I\'m using Flex(Lexical Analyzer), it\'s like this:

/* Just like UNIX wc */
%{
int chars = 0;
int words = 0;
int lines = 0;         


        
5条回答
  •  清歌不尽
    2020-12-07 22:37

    The scanner calls this function on end of file, so you can point it to another file and continue scanning its contents. If you don't need this, use

    %option noyywrap
    

    in the scanner specification.

    Although disabling yywrap is certainly the best option, it may also be possible to link with -lfl to use the default yywrap() function in the library fl (i.e. libfl.a) provided by flex. Posix requires that library to be available with the linker flag -ll and the default OS X install only provides that name.

提交回复
热议问题