Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

‘yylex’ was not declared in this scope #1

Closed
EXL opened this issue Nov 1, 2017 · 10 comments
Closed

‘yylex’ was not declared in this scope #1

EXL opened this issue Nov 1, 2017 · 10 comments

Comments

@EXL
Copy link
Contributor

@EXL EXL commented Nov 1, 2017

I can't compile your modern qt2 library.
This errors occurs on GCC 5.4.0, Flex 2.6.0 and GCC 7.2.0 and Flex 2.6.4:

$ make -j1
/usr/bin/cmake -H/home/baat/magx/qt2 -B/home/baat/magx/qt2/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/baat/magx/qt2/build/CMakeFiles /home/baat/magx/qt2/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: вход в каталог «/home/baat/magx/qt2/build»
make -f src/moc/CMakeFiles/moc-qt2.dir/build.make src/moc/CMakeFiles/moc-qt2.dir/depend
make[2]: вход в каталог «/home/baat/magx/qt2/build»
[  0%] Generating lex.yy.c
cd /home/baat/magx/qt2/build/src/moc && flex -o lex.yy.c /home/baat/magx/qt2/src/moc/moc.l
[  0%] Generating mocgen.cpp
cd /home/baat/magx/qt2/build/src/moc && yacc -d -o mocgen.cpp /home/baat/magx/qt2/src/moc/moc.y
cd /home/baat/magx/qt2/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/baat/magx/qt2 /home/baat/magx/qt2/src/moc /home/baat/magx/qt2/build /home/baat/magx/qt2/build/src/moc /home/baat/magx/qt2/build/src/moc/CMakeFiles/moc-qt2.dir/DependInfo.cmake --color=
Scanning dependencies of target moc-qt2
make[2]: выход из каталога «/home/baat/magx/qt2/build»
make -f src/moc/CMakeFiles/moc-qt2.dir/build.make src/moc/CMakeFiles/moc-qt2.dir/build
make[2]: вход в каталог «/home/baat/magx/qt2/build»
[  0%] Building CXX object src/moc/CMakeFiles/moc-qt2.dir/mocgen.cpp.o
cd /home/baat/magx/qt2/build/src/moc && /usr/bin/c++   -DQT_LITE_UNICODE -DQT_NO_CODECS -I/home/baat/magx/qt2/build/src/moc -I/home/baat/magx/qt2/src/moc -I/home/baat/magx/qt2/include -I/home/baat/magx/qt2/src/tools  -Wno-format-security -o CMakeFiles/moc-qt2.dir/mocgen.cpp.o -c /home/baat/magx/qt2/build/src/moc/mocgen.cpp
mocgen.cpp: In function ‘int yyparse()’:
mocgen.cpp:1925:23: error: ‘yylex’ was not declared in this scope
       yychar = yylex ();
                       ^
/home/baat/magx/qt2/src/moc/moc.y:443:39: error: ‘enterNameSpace’ was not declared in this scope
                           IDENTIFIER         { enterNameSpace($2); }
                                       ^
/home/baat/magx/qt2/src/moc/moc.y:444:7: error: ‘BEGIN’ was not declared in this scope
                           '{'                { BEGIN IN_NAMESPACE; }
       ^
/home/baat/magx/qt2/src/moc/moc.y:446:22: error: ‘leaveNameSpace’ was not declared in this scope
                           '}'                { leaveNameSpace();
                      ^
/home/baat/magx/qt2/src/moc/moc.y:447:51: error: ‘selectOutsideClassState’ was not declared in this scope
                           selectOutsideClassState();
                                                   ^
...

Any suggestions? Thanks!

@heliocastro
Copy link
Owner

@heliocastro heliocastro commented Nov 1, 2017

Hey, you got me curious.
Which distro are you using with gcc 5.4 ?

@heliocastro
Copy link
Owner

@heliocastro heliocastro commented Nov 1, 2017

@EXL
Copy link
Contributor Author

@EXL EXL commented Nov 1, 2017

Which distro are you using with gcc 5.4 ?

Ubuntu 16.04.3 LTS.

I reproduced the issue with bison, so i need change the code a little for
it, but yacc works perfectly.

Apparently all popular distributions use a symlink yacc => bison? I found this information, maybe it will come in handy.

https://www.di-mgt.com.au/converting_from_lex_and_yacc.html

@heliocastro
Copy link
Owner

@heliocastro heliocastro commented Nov 1, 2017

@EXL
Copy link
Contributor Author

@EXL EXL commented Nov 26, 2017

@heliocastro I did not find classic yacc in packages of modern GNU/Linux distros.

But I found a utility like Berkeley Yacc, and install this package, which available in Ubuntu, Debian and Arch Linux.

Then I changed the line #40 from yacc to byacc here and qt2 was successfully compiled.

Maybe it will help someone. Cheers!

@z3ntu
Copy link

@z3ntu z3ntu commented Dec 29, 2017

I hit the same issue with GCC 7.2.1 and bison 3.0.4 (which is symlinked to /usr/bin/yacc)

@heliocastro
Copy link
Owner

@heliocastro heliocastro commented Dec 31, 2017

Guys, happy new year and I'm travelling to celebrate the passage, but I promise see everything when I'm back. And yes, still need byacc, I didn't have time to proper port to modern business.

@heliocastro
Copy link
Owner

@heliocastro heliocastro commented Jan 6, 2018

Fixed now using byacc detection and new compilation method.
For debia like distros, the package byacc need to be installed.
Best regards

@heliocastro heliocastro closed this Jan 6, 2018
@z3ntu
Copy link

@z3ntu z3ntu commented Jan 6, 2018

Compiles fine for me now!
btw is the designer-qt2 also transparent for you?

@heliocastro
Copy link
Owner

@heliocastro heliocastro commented Jan 8, 2018

Hi
I forgot to update the readm on Qt2, I did only on kde2 readm. Here's the excerpt that interests you:


There's a issue as Qt2 didn't recognize ARGB visuals on those times ( of course ! ), so thanks to Gustavo Boiko that found the issue. So, if you do intend to run software like Qt designer, export this on command line: XLIB_SKIP_ARGB_VISUALS=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.