Problem linking the Class++ example with Conan and CMake

Wouter Beek <[email protected]>
Newsgroups gmane.comp.parsers.bison.general
Message-ID <CAEh2WcPBt17nQ7dsv2PFSo=_RWJvG4_PF5SQ-GUmkQHVv8+rUA@mail.gmail.com>
Hi,

I'm trying to build the example calc++ program with Conan and CMake:
https://github.com/wouterbeek/conan-cmake-bison-flex

The promise of Conan and CMake is that one could ultimately build a
Flex/Bison program on multiple platforms, which is more difficult with
traditional build systems.

Unfortunately, I'm currently stuck at the linking phase (see the
output below).  Does anybody know what I'm doing wrong / how to
proceed?

PS: The Calc++ example seems to be partially missing from Git master.
Is this intentional?

---
Cheers,
Woter.

```
$ cmake --build . -- VERBOSE=1
/usr/bin/cmake -S/home/wbeek/tmp/calc++ -B/home/wbeek/tmp/calc++/Debug
--check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start
/home/wbeek/tmp/calc++/Debug/CMakeFiles
/home/wbeek/tmp/calc++/Debug/CMakeFiles/progress.marks
/usr/bin/gmake -f CMakeFiles/Makefile2 all
gmake[1]: Entering directory '/home/wbeek/tmp/calc++/Debug'
/usr/bin/gmake -f CMakeFiles/calc++.dir/build.make CMakeFiles/calc++.dir/depend
gmake[2]: Entering directory '/home/wbeek/tmp/calc++/Debug'
[ 16%] [FLEX][lexer] Building scanner with flex 2.6.4
cd /home/wbeek/tmp/calc++ && /usr/bin/flex
-o/home/wbeek/tmp/calc++/Debug/Lexer.cpp
/home/wbeek/tmp/calc++/Lexer.ll
[ 33%] [BISON][parser] Building parser with bison 3.3.2
/home/wbeek/.conan/data/bison/3.3.2/bincrafters/stable/package/7e924ee4fb46c796a19516dcf956dd2bc0171a91/bin/bison
--defines=/home/wbeek/tmp/calc++/Debug/Parser.hpp -o
/home/wbeek/tmp/calc++/Debug/Parser.cpp
/home/wbeek/tmp/calc++/Parser.yy
cd /home/wbeek/tmp/calc++/Debug && /usr/bin/cmake -E cmake_depends
"Unix Makefiles" /home/wbeek/tmp/calc++ /home/wbeek/tmp/calc++
/home/wbeek/tmp/calc++/Debug /home/wbeek/tmp/calc++/Debug
/home/wbeek/tmp/calc++/Debug/CMakeFiles/calc++.dir/DependInfo.cmake
--color=
Dependee "/home/wbeek/tmp/calc++/Debug/CMakeFiles/calc++.dir/DependInfo.cmake"
is newer than depender
"/home/wbeek/tmp/calc++/Debug/CMakeFiles/calc++.dir/depend.internal".
Dependee "/home/wbeek/tmp/calc++/Debug/CMakeFiles/CMakeDirectoryInformation.cmake"
is newer than depender
"/home/wbeek/tmp/calc++/Debug/CMakeFiles/calc++.dir/depend.internal".
Scanning dependencies of target calc++
gmake[2]: Leaving directory '/home/wbeek/tmp/calc++/Debug'
/usr/bin/gmake -f CMakeFiles/calc++.dir/build.make CMakeFiles/calc++.dir/build
gmake[2]: Entering directory '/home/wbeek/tmp/calc++/Debug'
[ 50%] Building CXX object CMakeFiles/calc++.dir/Driver.cpp.o
/usr/bin/c++   -I/home/wbeek/tmp/calc++/Debug -I/home/wbeek/tmp/calc++
 -g   -o CMakeFiles/calc++.dir/Driver.cpp.o -c
/home/wbeek/tmp/calc++/Driver.cpp
[ 66%] Building CXX object CMakeFiles/calc++.dir/Parser.cpp.o
/usr/bin/c++   -I/home/wbeek/tmp/calc++/Debug -I/home/wbeek/tmp/calc++
 -g   -o CMakeFiles/calc++.dir/Parser.cpp.o -c
/home/wbeek/tmp/calc++/Debug/Parser.cpp
[ 83%] Building CXX object CMakeFiles/calc++.dir/Lexer.cpp.o
/usr/bin/c++   -I/home/wbeek/tmp/calc++/Debug -I/home/wbeek/tmp/calc++
 -g   -o CMakeFiles/calc++.dir/Lexer.cpp.o -c
/home/wbeek/tmp/calc++/Debug/Lexer.cpp
[100%] Linking CXX executable bin/calc++
/usr/bin/cmake -E cmake_link_script CMakeFiles/calc++.dir/link.txt --verbose=1
/usr/bin/c++    -g   CMakeFiles/calc++.dir/Driver.cpp.o
CMakeFiles/calc++.dir/Parser.cpp.o CMakeFiles/calc++.dir/Lexer.cpp.o
-o bin/calc++ /home/wbeek/.conan/data/flex/2.6.4/bincrafters/stable/package/7e924ee4fb46c796a19516dcf956dd2bc0171a91/lib/libfl.a
/usr/bin/ld: /home/wbeek/.conan/data/flex/2.6.4/bincrafters/stable/package/7e924ee4fb46c796a19516dcf956dd2bc0171a91/lib/libfl.a(libmain.o):
in function `main':
/home/wbeek/.conan/data/flex/2.6.4/bincrafters/stable/build/7e924ee4fb46c796a19516dcf956dd2bc0171a91/source_subfolder/src/libmain.c:33:
undefined reference to `yylex'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/calc++.dir/build.make:127: bin/calc++] Error 1
gmake[2]: Leaving directory '/home/wbeek/tmp/calc++/Debug'
gmake[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/calc++.dir/all] Error 2
gmake[1]: Leaving directory '/home/wbeek/tmp/calc++/Debug'
gmake: *** [Makefile:84: all] Error 2
```

---
Best regards,
Wouter Beek.

Email: [email protected]
WWW: https://triply.cc
Tel: +31647674624

_______________________________________________
[email protected] https://lists.gnu.org/mailman/listinfo/help-bison
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.