1
After creating the file .l
, put the necessary flex command on the command line of Visual Studio always gives this error. I tried to put the mentioned library in the directory but the problem remains.
Error:
Microsoft (R) C/C++ Optimizing Compiler Versão 19.11.25547 para x86 Copyright (C) Microsoft Corporation. Todos os direitos reservados. lex.yy.c lex.yy.c(397): warning C4005: 'yywrap': redefinição de macro lex.yy.c(73): note: consulte a definição anterior de 'yywrap' calcula.l(5): fatal error C1083: Não é possível abrir arquivo incluir: 'unistd.h': No such file or directory
File code .l
:
%option main %x COMENT %% "//" BEGIN( COMENT ); .|\n|\r <COMENT>. ECHO; <COMENT>\n|\r BEGIN( INITIAL ); %%
You set the entire text to link to the image on purpose?
– I_like_trains
It was not purposeful. I am new here.
– user101221
I’m sorry, I’ve changed
– user101221
No, the project is provided by the teacher. A simple example of a compiler that should accept comments in C++.
– user101221
I think I understand the flex now, but it’s strange that it uses unistd. h, try to use the parameter
--wincompat
or you may have to install Cygwin or gnuwin32– Guilherme Nascimento
I don’t know if you couldn’t explain it to me. I’ll do it again: The goal is to create a file (txt type) in the format
.l
and make it work as a compiler. By developing the visual studio by calling the flex tool with the commandwin_flex aaa.l
,for example by following the commandcl lex.yy.c
and having thelex.yy
. And right now, in the developer, you should only play something in comment form. In my case, I can put the commandcl lex.yy.c
, he creates lex.yy.obj but then when placinglex.yy
gives the mentioned error– user101221
in the
win_flex
adds the parameter--wincompat
as I said in the previous comment, so for examplewin_flex --wincompat aaa.l
– Guilherme Nascimento
It already works with this parameter. Thanks for the help.
– user101221