![]() "C:\Users\Ludovico\AppData\Roaming\JetBrains\CLion 2017.1.3\bin\cmake\bin\cmake.exe" -build C:\Users\Ludovico\CLionProjects\SFMLprova1\cmake-build-debug -target SFMLprova1 -j 4 Set (CMAKE_MODULE_PATH "C:/Code/Librerie/SFML-2.4.2/cmake/Modules" $ ) To this CLION can be developed normally with QT.Set (SFML_ROOT "C:/Code/Librerie/SFML-2.4.2" ) If the compiled success program will run automatically: Then we click int main(.)Run button on the left: The determinated version is required for the overload function, and the QOverLoad needs the compiler to support C 11 Let's write a small example, let a SpinBox and Slider can link each other: #include Reload changes:Ĭlion will automatically generate new makefiles for compiling projects, and now code can also be used. It is worth noting that a benefit of using the QT provided by the system is that the program can use the style and theme of the system, but the disadvantage is that the version may generate inconsistencies with the inconsistency we want to use.Īfter the modification, click on the figure. # If you don't want CMAKE to search system catalog (will cause compilation using the system installation Qt instead of we are configured), you need to prompt the Find_Package command. # If you use the system's cmake, you will prioritize the system providing module because cmake will give priority to cmake_system_prefix_path # Qt_dir and qt_version are the environment variables that specify the Qt installation directory and version. # Set the directory where the QT5 CMAKE module is located, if not set, the version will be provided using the version # Automatically call MOC, UIC, RCC to process QT extension portions So we need to put CMakeLists.txtModify it as follows: cmake_minimum_required(VERSION 3.0) The point to explain in advance is that CLION is based CMakeLists.txtDocuments to organize and set up items, so if we need to add third-party libraries such as QT or change compilation behavior, it is only necessary to modify. Set QT code completion and project compilation Of course, the generated path of the executable file can be specified, this is the default option of the CLion.Īt this time, the compilation operation and code is still not used, so we will set up compilation and code completion. The project structure is shown in the figure:Ĭmake-build-releaseThe directory is the intermediate code of the MOC and other tools and where the executable file is generated. Here is to create a QT5 project, CLION does not distinguish between ordinary C projects and QT projects (after all, QT items are generally C projects or C / QML projects), so this is created: Subsequently, your compiler is to support C 11, if you support C 14 or C 17, it is best. Note that CLION comes with a cmake if we want to use some of the CMAKE modules provided by the system, then you must replace the CMAKE of the system as shown. If you need help, you can go to the CLION official website to find the installation method.ĬLION defaults to build engineering, however, using GCC is unable to use code completion, so we replace Toolchains to Clang: Ready to workĬlion's installation and activation beyond the scope of this article, we assume that you have already installed CLion. So I will introduce Configure CLION (another powerful C IDE) as a development environment of QT5, avoiding the installation of another large software while using existing toolchain. However, a handy tool will greatly improve production efficiency, and if you use other tools to develop, you have to think about learning the cost of using Qtcreator. If there is no special reason you should use it. As the old IDE provides a lot of optimizations while providing powerful features. Qtcreator is always not two when using QT for program development. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |