CMake's PCH support and boost.test linker error
Hello Boost users
I have here a strange problem which occurs only if I try to build with
precompiled headers using CMake. I've configured the project for use
with dynamically linking. The error is:
/usr/bin/ld:
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o: in
function `_start':
(.text+0x24): undefined reference to `main'
Something obvious?
Thanks in advance
The project's reduce is:
---8<--- test_driver.cpp --- 8< ----
#defineBOOST_TEST_MODULE "My Test Suite"
#include
Hello Boost users
I have here a strange problem which occurs only if I try to build with precompiled headers using CMake. I've configured the project for use with dynamically linking. The error is:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o: in function `_start': (.text+0x24): undefined reference to `main'
Something obvious?
Thanks in advance
The project's reduce is:
[...] attached a minimal example. So it can be reproduced.
of interest is the error message: [ 25%] Linking CXX executable boost_utf_pch /usr/bin/cmake -E cmake_link_script CMakeFiles/boost_utf_pch.dir/link.txt --verbose=1 /usr/bin/c++ CMakeFiles/boost_utf_pch.dir/test_driver.cpp.o CMakeFiles/boost_utf_pch.dir/test.cpp.o -o boost_utf_pch /usr/lib64/libboost_unit_test_framework.so /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o: in function `_start': (.text+0x24): undefined reference to `main' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/boost_utf_pch.dir/build.make:141: boost_utf_pch] Error 1 make[2]: Leaving directory '/home/olaf/work/CXX/boost_test_pch/build' make[1]: *** [CMakeFiles/Makefile2:98: CMakeFiles/boost_utf_pch.dir/all] Error 2 make[1]: Leaving directory '/home/olaf/work/CXX/boost_test_pch/build' make: *** [Makefile:106: all] Error 2 and my system: $ lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: Fedora Description: Fedora release 33 (Thirty Three) Release: 33 Codename: ThirtyThree $ c++ --version c++ (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9) Same problems with clang version 11.0.0 (Fedora 11.0.0-2.fc33)
participants (1)
-
Olaf Peter