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. Trying Cmake
Forum Updated to NodeBB v4.3 + New Features

Trying Cmake

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 1.3k Views 2 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.
  • O Offline
    O Offline
    ofmrew
    wrote on last edited by
    #1

    I noted that creating new class or adding the .h and .cpp to CMakeLists.txt has the opposite effects: new class only provide the entries for CMakeLists, you must manually add them and then compile to get them to show in QtCreator, but adding the entries to CMakeLists does not update the project. I take it that this will be addresses in the future, but is there another better way of adding a class?

    Also what about adding libraries?

    1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by Axel Spoerl
      #2

      What do you mean by "opposite effects"?

      Adding source files (like x.h / x.cpp) to CMakeLists.txt triggers QtCreator to run configure - see here.
      The new sources will be visible in Qt Creators source tree, provided that

      • entries have been made in the right CMakeLists.txt and
      • CMakeLists.txt is syntactically correct.

      If you use a recent Qt Creator version, it is not necessary to compile to make new sources visible.

      For adding libraries, I suggest you read the CMake documentation for packages and libraries. As an alternative, you can load any library at run time with QLibrary.

      Software Engineer
      The Qt Company, Oslo

      O 1 Reply Last reply
      2
      • Axel SpoerlA Axel Spoerl

        What do you mean by "opposite effects"?

        Adding source files (like x.h / x.cpp) to CMakeLists.txt triggers QtCreator to run configure - see here.
        The new sources will be visible in Qt Creators source tree, provided that

        • entries have been made in the right CMakeLists.txt and
        • CMakeLists.txt is syntactically correct.

        If you use a recent Qt Creator version, it is not necessary to compile to make new sources visible.

        For adding libraries, I suggest you read the CMake documentation for packages and libraries. As an alternative, you can load any library at run time with QLibrary.

        O Offline
        O Offline
        ofmrew
        wrote on last edited by
        #3

        @Axel-Spoerl I was using Add New to add a class; however, I found that my system is out date, QtCreator is 6.0.2 so I used MaintenanceTool to updgrade: Big Mistake as it failed on updating at 43% with error message:
        Cannot Start: "D:/Qt/Tools/QtCreator\bin\sdktool.exe rmDebugger--id Debugger.qt.tools.win64_mingw900": Process failed to start: The system cannot find the file specified. It is hung. It cycles back after either Retry or Ignore and since the dialog is modal Cancel does not work.

        I ended the task and now I have no QtCreator or Qt. Any suggestions?

        1 Reply Last reply
        0
        • Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote on last edited by
          #4

          Sorry to read about troubles downloading the latest Qt Creator version.
          It's up and running on our side, so it was probably an intermittent connection issue.
          Reboot and retry, I'd say.

          Software Engineer
          The Qt Company, Oslo

          O 1 Reply Last reply
          0
          • Axel SpoerlA Axel Spoerl

            Sorry to read about troubles downloading the latest Qt Creator version.
            It's up and running on our side, so it was probably an intermittent connection issue.
            Reboot and retry, I'd say.

            O Offline
            O Offline
            ofmrew
            wrote on last edited by
            #5

            @Axel-Spoerl Qmake works but not Cmake. installed the latest version of Cmake so tomorrow I will try setting the environmental variable CXX, unless someone has a better option.

            O 1 Reply Last reply
            0
            • O ofmrew

              @Axel-Spoerl Qmake works but not Cmake. installed the latest version of Cmake so tomorrow I will try setting the environmental variable CXX, unless someone has a better option.

              O Offline
              O Offline
              ofmrew
              wrote on last edited by
              #6

              @ofmrew CMAKE does not work with latest version of Qt on Win11 it issues:
              D:\qtprograms\testCMAKE\CMakeLists.txt:3: error: The CMAKE_CXX_COMPILER: D:/Qt/Tools/mingw900_64/bin/g++.exe is not a full path to an existing compiler tool. Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.
              There is no Win11 environment variable "CXX". I have looks at the Kit s ab they seem OK, I have looked at they documentation and I have looked on the Internet, but I have not found the solution. I would greatly appreciate it if someone could point me in the same direction.

              I should point out the same problem occurs on Linux.

              1 Reply Last reply
              0
              • Axel SpoerlA Offline
                Axel SpoerlA Offline
                Axel Spoerl
                Moderators
                wrote on last edited by
                #7

                You'd have to give us a bit more food:

                • post your CMakeLists.txt
                • post the output of configure
                • post a screenshot of your compile kits in Qt Creator

                Software Engineer
                The Qt Company, Oslo

                O 1 Reply Last reply
                0
                • Axel SpoerlA Axel Spoerl

                  You'd have to give us a bit more food:

                  • post your CMakeLists.txt
                  • post the output of configure
                  • post a screenshot of your compile kits in Qt Creator
                  O Offline
                  O Offline
                  ofmrew
                  wrote on last edited by
                  #8

                  I have the latest version of Qt loaded on a Mint Linux computer and on a Win11 computer, both had the same problem with CXX. The Linux can now find CXX, but on a simple compile issues the error:
                  :-1: error: CMakeFiles/Project1.dir/mainwindow.cpp.o: undefined reference to symbol '_ZdlPvm@@CXXABI_1.3.9'
                  and
                  :-1: error: /lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
                  Still working on the Win11, but what about the Linux problem?

                  O 1 Reply Last reply
                  0
                  • O ofmrew

                    I have the latest version of Qt loaded on a Mint Linux computer and on a Win11 computer, both had the same problem with CXX. The Linux can now find CXX, but on a simple compile issues the error:
                    :-1: error: CMakeFiles/Project1.dir/mainwindow.cpp.o: undefined reference to symbol '_ZdlPvm@@CXXABI_1.3.9'
                    and
                    :-1: error: /lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
                    Still working on the Win11, but what about the Linux problem?

                    O Offline
                    O Offline
                    ofmrew
                    wrote on last edited by
                    #9

                    @ofmrew On Win11 when I Clear Camke Config. and run Cmake I get:
                    Running D:\QtNew\Tools\CMake_64\bin\cmake.exe -S D:/qtprograms/testCMAKE -B D:/qtprograms/build-testCMAKE-Desktop_Qt_6_2_2_MinGW_64_bit-Debug in D:\qtprograms\build-testCMAKE-Desktop_Qt_6_2_2_MinGW_64_bit-Debug.
                    -- The CXX compiler identification is unknown
                    CMake Error at CMakeLists.txt:3 (project):
                    No CMAKE_CXX_COMPILER could be found.

                    Tell CMake where to find the compiler by setting either the environment
                    variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
                    to the compiler, or to the compiler name if it is in the PATH.

                    -- Configuring incomplete, errors occurred!
                    See also "D:/QtPrograms/build-testCMAKE-Desktop_Qt_6_2_2_MinGW_64_bit-Debug/CMakeFiles/CMakeOutput.log".
                    See also "D:/QtPrograms/build-testCMAKE-Desktop_Qt_6_2_2_MinGW_64_bit-Debug/CMakeFiles/CMakeError.log".
                    CMake process exited with exit code 1.

                    Elapsed time: 00:00.

                    The initial Cmake Config is:
                    -DCMAKE_BUILD_TYPE:STRING=Debug
                    -DCMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}
                    -DCMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}
                    -DCMAKE_GENERATOR:STRING=Ninja
                    -DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}
                    -DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
                    -DQT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}
                    and there is no Current Config.
                    Should I add those item in Current Config?

                    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