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. First Qt cmd line app
Forum Update on Monday, May 27th 2025

First Qt cmd line app

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 573 Views
  • 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.
  • P Offline
    P Offline
    Pshemko
    wrote on last edited by
    #1

    Hi,

    I am a C++ developer and wanted to try Qt a bit. Normally using VC++ 2017, so I installed Qt version 5.12 and created a new Qt cmd line app using the creator. However, when creating a simplest class deriving from QObject I get lots of linker errors related to some metaObject classes. It makes very little sense, the whole compile/link/debug process seems quite complicated compared to VisualStudio. I know it is very different but please, could someone help with this? I get the following errors:

    02:53:46: Running steps for project FirstConsoleApp...
    02:53:46: Starting: "C:\Development\Qt\Qt5.12.0\5.12.0\msvc2017_64\bin\qmake.exe" D:\Development\Qt\FirstConsoleApp\FirstConsoleApp.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
    Info: creating stash file D:\Development\Qt\build-FirstConsoleApp-Desktop_Qt_5_12_0_MSVC2017_64bit-Release.qmake.stash
    02:53:47: The process "C:\Development\Qt\Qt5.12.0\5.12.0\msvc2017_64\bin\qmake.exe" exited normally.
    02:53:47: Starting: "C:\Development\Qt\Qt5.12.0\Tools\QtCreator\bin\jom.exe" -f D:/Development/Qt/build-FirstConsoleApp-Desktop_Qt_5_12_0_MSVC2017_64bit-Release/Makefile qmake_all

    jom 1.1.2 - empower your cores

    02:53:47: The process "C:\Development\Qt\Qt5.12.0\Tools\QtCreator\bin\jom.exe" exited normally.
    02:53:47: Starting: "C:\Development\Qt\Qt5.12.0\Tools\QtCreator\bin\jom.exe"
    C:\Development\Qt\Qt5.12.0\Tools\QtCreator\bin\jom.exe -f Makefile.Release
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -I..\FirstConsoleApp -I. -IC:\Development\Qt\Qt5.12.0\5.12.0\msvc2017_64\include -IC:\Development\Qt\Qt5.12.0\5.12.0\msvc2017_64\include\QtCore -Irelease -IC:\Development\Qt\Qt5.12.0\5.12.0\msvc2017_64\mkspecs\win32-msvc -Forelease\ @C:\Users\PRZEMY~1\AppData\Local\Temp\main.obj.1784.15.jom
    main.cpp
    ..\FirstConsoleApp\main.cpp(105): warning C4100: 'order': unreferenced formal parameter
    ..\FirstConsoleApp\main.cpp(30): warning C5046: 'anonymous-namespace'::QOrderCache::metaObject': Symbol involving type with internal linkage not defined ..\FirstConsoleApp\main.cpp(30): warning C5046: 'anonymous-namespace'::QOrderCache::qt_metacast': Symbol involving type with internal linkage not defined
    ..\FirstConsoleApp\main.cpp(30): warning C5046: 'anonymous-namespace'::QOrderCache::qt_metacall': Symbol involving type with internal linkage not defined ..\FirstConsoleApp\main.cpp(16): warning C5046: 'anonymous-namespace'::QOrder::metaObject': Symbol involving type with internal linkage not defined
    ..\FirstConsoleApp\main.cpp(16): warning C5046: 'anonymous-namespace'::QOrder::qt_metacast': Symbol involving type with internal linkage not defined ..\FirstConsoleApp\main.cpp(16): warning C5046: 'anonymous-namespace'::QOrder::qt_metacall': Symbol involving type with internal linkage not defined
    ..\FirstConsoleApp\main.cpp(90): warning C5046: 'anonymous-namespace'::QTradingService::metaObject': Symbol involving type with internal linkage not defined ..\FirstConsoleApp\main.cpp(90): warning C5046: 'anonymous-namespace'::QTradingService::qt_metacast': Symbol involving type with internal linkage not defined
    ..\FirstConsoleApp\main.cpp(90): warning C5046: 'anonymous-namespace'::QTradingService::qt_metacall': Symbol involving type with internal linkage not defined link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:release\FirstConsoleApp.exe @C:\Users\PRZEMY~1\AppData\Local\Temp\FirstConsoleApp.exe.1784.2484.jom main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl anonymous namespace'::QOrder::metaObject(void)const " (?metaObject@QOrder@?A0x87dcd2e0@@UEBAPEBUQMetaObject@@XZ)
    main.obj : error LNK2001: unresolved external symbol "public: virtual void * __cdecl anonymous namespace'::QOrder::qt_metacast(char const *)" (?qt_metacast@QOrder@?A0x87dcd2e0@@UEAAPEAXPEBD@Z) main.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl anonymous namespace'::QOrder::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QOrder@?A0x87dcd2e0@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
    main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl anonymous namespace'::QOrderCache::metaObject(void)const " (?metaObject@QOrderCache@?A0x87dcd2e0@@UEBAPEBUQMetaObject@@XZ) main.obj : error LNK2001: unresolved external symbol "public: virtual void * __cdecl anonymous namespace'::QOrderCache::qt_metacast(char const *)" (?qt_metacast@QOrderCache@?A0x87dcd2e0@@UEAAPEAXPEBD@Z)
    main.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl anonymous namespace'::QOrderCache::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QOrderCache@?A0x87dcd2e0@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z) main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl anonymous namespace'::QTradingService::metaObject(void)const " (?metaObject@QTradingService@?A0x87dcd2e0@@UEBAPEBUQMetaObject@@XZ)
    main.obj : error LNK2001: unresolved external symbol "public: virtual void * __cdecl anonymous namespace'::QTradingService::qt_metacast(char const *)" (?qt_metacast@QTradingService@?A0x87dcd2e0@@UEAAPEAXPEBD@Z) main.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl anonymous namespace'::QTradingService::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QTradingService@?A0x87dcd2e0@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
    release\FirstConsoleApp.exe : fatal error LNK1120: 9 unresolved externals
    jom: D:\Development\Qt\build-FirstConsoleApp-Desktop_Qt_5_12_0_MSVC2017_64bit-Release\Makefile.Release [release\FirstConsoleApp.exe] Error 1120
    jom: D:\Development\Qt\build-FirstConsoleApp-Desktop_Qt_5_12_0_MSVC2017_64bit-Release\Makefile [release] Error 2
    02:53:50: The process "C:\Development\Qt\Qt5.12.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
    Error while building/deploying project FirstConsoleApp (kit: Desktop Qt 5.12.0 MSVC2017 64bit)
    When executing step "Make"
    02:53:50: Elapsed time: 00:04.

    I think I have set up the variables correctly in the Kits section. Not really sure what is wrong.
    Thanks a lot for any hints.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Can you show your main.cpp file ?

      Also did you put your QObject based class in your main.cpp file ?

      If so, did you also #include "main.moc" ? at the bottom of your main.cpp file ?

      This last one is mandatory if you didn't declare your QObject derived class in its own header.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by dheerendra
        #3

        Did you create default project and no modifications from you. Does this simple project work ?

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        1

        • Login

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