Using CLion for C++ development is pretty great for numerous reasons and on Windows, I prefer using Mingw-w64 for compilation. The easiest way to install it and manage libraries in my opinion is to use MSYS2. MSYS2 provides a terminal interface via mintty which works well but it gets annoying having to jump between CLion and a separate terminal window. CLion however provides a method of embedding a terminal within the CLion UI.
There is an issue though in that it isn’t possible to just put
C:msys64usrbinbash.exe --login into the shell path setting and be done with it. CLion will complain that it cannot open a terminal when you click the terminal button.
It is possible to point it to
C:msys64mingw64.exe but now the terminal button will launch a separate window for the MSYS2 terminal. That’s the exact thing I wanted to avoid!
Install this Cppcheck plugin into CLion Configure the plugin with the absolute path to the Cppcheck executable into the 'Cppcheck Path' configuration field Windows. Download the executable file named CLion-2019.2.exe, which when run will install the 64-bit version of CLion. It may display another screen asking you to enter information; you can Its icon will appear on your screen as follows. Save this file for future use, in case you need to reinstall it. I have just downloaded CLion and tried to test it. My code runs without any errors. I would like to execute the test.exe file without CLion. So I build it with Strg+F9 and then I find the test.exe file in: C: Users ame CLionProjects opl cmake-build-debug. A POWER TOOL FOR A POWER LANGUAGE Smart C and C editor Thanks to native C and C support, including modern C standards, libc and Boost, CLion knows your code through and through and takes care of the routine while you focus on the important things. Please Note: This is an automatically updated package. @Christian-Ehrlicher said in Can't compile project using CLion and CMake. Since you can't mix (msvc) / should not (mingw) debug and release libs it's dangerous to use Qt release dlls with a debug build of your program.
What we have to do instead is write a small .bat file with a command to launch the terminal and point CLion to that batch file. I recommend making the batch file in the same folder that MSYS2 is installed in and name it clion.bat.
Clion Exe Video
The contents of the batch file should be
What the above command does is set two environment variables then launch the MSYS2 terminal directly.
For MSYSTEM, you can use MSYS, MINGW32 or MINGW64 which corresponds to the base MSYS terminal, the 32bit Mingw-w64 terminal and the 64bit Mingw-w64 terminal respectively.
The CHERE_INVOKING variable is so that the terminal will change the directory to the current project directory when the terminal button is clicked in CLion.
All of the above assumes that the 64bit version of MSYS2 was installed to the default directory. If you have installed it elsewhere, you would need to adjust the filepaths accordingly.
Several C/C++ integrated development environments, such as CLion, VS Code, Codeblocks, etc, are available on the internet. But, if you are someone who loves to use JetBrains products, then CLion is for you. It is an IDE developed by JetBrains to run C/C++ programs. If you want to install CLion on your computer, then stick with me in this article. I guarantee you that CLion will be installed on your computer at the end of this article without any errors. Enough talks! Let’s get started :
Follow the below steps to install and set up CLion for C/C++ programming:
- First of all, you need to download the MinGW compiler to compile your C/C++ programs.
- Click here to download the MinGW compiler.
3. Install the MinGW compiler.
4. Now, add MinGW to the path by navigating to This PC→C:/→Program Files (x86)→MinGW-w64→i686-8.1.0-POSIX-dwarf-rt_v6-rev0→mingw32→bin.
Copy and paste the path in the environment variables. Right-click on This PC→Properties→Advanced System Settings→Environment variables.
5. Click on the path and then Edit→New. Paste the copied path here and click ‘ok.’
6. Click here to download the CLion IDE.
7. Install the .exe file, as shown in the below animation. Do not forget to check all the checkboxes shown in the below animation:
8. Reboot your computer at the time of installation, or you can reboot it later by clicking on “I want to manually reboot later.”
9. After rebooting your computer, type “CLion” on the Windows search bar and open the CLion IDE.
10. Click on “Do not import settings.”
11. If you have a license server or activation code, then you can easily activate it by entering them. Otherwise, you can use use the trial version(free for 30 days).
12. Click on evaluate for free. Enter your email address if you want to subscribe to the CLion newsletter.
13. Click on the “Evaluate” button.
14. Now, create a new project by clicking on the “Create New Project” button and click on “C Executable.”
15. Enter the name and the location of the project and then click on the “Create” button
Now you are all set to run C programs on CLion IDE without any interruptions. Let’s try to run a simple c program to check if everything is working correctly or not.
As you can see in the above animation, the C program is running perfectly. So, that’s how you can set up and run a C program in CLion IDE with ease. If you want to learn C programming in detail with notes for free, click here to watch my C programming tutorial.
Clion Execute Main
Sir will I be able to create Pc and Mobile apps after your C and C++ course? Also sir please make a course on game development, but not using softwares like Unity, Unreal, Cry or any other, but using frameworks like Ursina Engine where our code is our game.