Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. can't find linker symbol for virtual table for 'QCoreApplication' value - runtime error in hello world program
Forum Updated to NodeBB v4.3 + New Features

can't find linker symbol for virtual table for 'QCoreApplication' value - runtime error in hello world program

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 388 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dananarama
    wrote on last edited by dananarama
    #1

    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.

    jsulmJ 1 Reply Last reply
    0
    • D dananarama

      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.

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply
      1
      • jsulmJ jsulm

        @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

        D Offline
        D Offline
        dananarama
        wrote on last edited by
        #3

        @jsulm This happens whether I start the app from inside creator or standalone.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved