User forums > Help
Linking flex
twentytortures:
I'm using flex(http://www.gnu.org/software/flex/flex.html) on windows and I'm having problems linking.
I don't know how much more I can explain, here is my output:
--- Code: ---Compiling: F:\fun\flex\bin\lex.yy.cc
Execution of 'mingw32-g++.exe -IF:\fun\flex\include -c F:\fun\flex\bin\lex.yy.cc -o F:\fun\flex\bin\lex.yy.o' in 'F:\fun\flex\lib' failed.
Nothing to be done.
--- End code ---
Under link libraries I have: F:\fun\flex\lib\libfl.a
Under other linker options I have: -lfl
I'm mostly a Java programmer so I'm not to familiar with the C++ compilers. I'm using MinGW to try to compile this. Am I doing something stupid?
TDragon:
This could mean the file "lex.yy.cc" might not exist. Have you tried running that command (mingw32-g++.exe ... lex.yy.o) from a command prompt?
Note: I'm currently using Flex in a project, but only the C version; I've never tried the C++ interface.
eranif:
Like TDragon mentioned, the file lex.yy.cc might not exist, you first need to execute the flex tool:
--- Code: ---flex -L flexfile.l
--- End code ---
where flexfile.l is your lexer's syntax file (usually suffixed with .l).
Once the compilation of the flex tool is done, you should have the default file name lex.yy.c Note that the default file is a 'C'. If you want to generate the C++ file, you should include FlexLexer.h, and invoke the flex like this:
--- Code: ---flex -L -+ flexfile.l
--- End code ---
BTW, the
--- Code: ----L
--- End code ---
is for not including the #line directive in the generated code.
I suggest that you will add some pre build steps to generate lex.yy.c file prior compilation.
HTH,
Eran
thomas:
Hmm... but it says "Execution of 'mingw32-g++.exe [blah blah] failed.".
If the file lex.yy.cc was missing, it would say something like "mingw32-g++: Error: cannot open input file [blah blah]".
This looks more like a badly installed (or badly detected) MinGW to me.
twentytortures:
Well I think my problem is that MinGW doesn't like Vista. I was able to get everything to compile fine from the command line at school on an XP machine. I can't even get it to compile on the command line on Vista. I would use a more windows friendly compiler instead but the problem I have is that I'm using a reference written for Linux so I'm not sure how the commands translate to windows compilers.
lex.yy.cc does exist. I generated it on the command line.
Navigation
[0] Message Index
[#] Next page
Go to full version