can't find linker symbol for virtual table for 'QCoreApplication' value - runtime error in hello world program
Unsolved
General and Desktop
-
I am unable to run a simple hello world program, encountering the error message:
can't find linker symbol for virtual table for `QCoreApplication' value
Here is the source:
main.cpp
#include <QCoreApplication> #include <iostream> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); std::cout << "Hello World!"; return a.exec(); }
CMakeLists.txt
cmake_minimum_required(VERSION 3.14) project(demo2 LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt5 REQUIRED COMPONENTS Core ) add_executable(demo2 main.cpp ) target_link_libraries(demo2 Qt5::Core )
I am wondering if there is an issue with there being multiple/mismatching libQt5Core library files. Here is some library info:
ldd demo2
linux-vdso.so.1 (0x00007ffe802d2000) libQt5Core.so.5 => /home/dan/Qt/5.12.3/gcc_64/lib/libQt5Core.so.5 (0x00007f6cfbbd9000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6cfb850000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6cfb638000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6cfb247000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6cfb028000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6cfae0b000) libicui18n.so.56 => /home/dan/Qt/5.12.3/gcc_64/lib/libicui18n.so.56 (0x00007f6cfa972000) libicuuc.so.56 => /home/dan/Qt/5.12.3/gcc_64/lib/libicuuc.so.56 (0x00007f6cfa5ba000) libicudata.so.56 => /home/dan/Qt/5.12.3/gcc_64/lib/libicudata.so.56 (0x00007f6cf8bd7000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6cf89d3000) libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f6cf87d1000) libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f6cf84ba000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6cf811c000) /lib64/ld-linux-x86-64.so.2 (0x00007f6cfc56f000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f6cf7eaa000)
ldconfig -p | grep libQt5Core
libQt5Core.so.5 (libc6,x86-64, OS ABI: Linux 2.6.28) => /home/dan/Qt/5.12.3/gcc_64/lib/libQt5Core.so.5 libQt5Core.so.5 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 libQt5Core.so (libc6,x86-64, OS ABI: Linux 2.6.28) => /home/dan/Qt/5.12.3/gcc_64/lib/libQt5Core.so
Any assistance would be greatly appreciated.
-
@dananarama Do you mean this happens when you try to start your app outside of QtCreator? If so, did you deploy your app first? https://doc.qt.io/qt-5/linux-deployment.html