Trying Cmake
-
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?
-
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.
-
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.
@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?
-
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. -
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.@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.
-
@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.
@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.
-
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
-
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
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? -
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?@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?