Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run C language code on JetBrains CLion

Tags:

c

clion

I get the following error :

Error:Neither MinGW nor Cygwin is selected

Do you have idea for resolve this issue?

like image 984
Ramin Farajpour Cami Avatar asked Jan 23 '16 08:01

Ramin Farajpour Cami


People also ask

Can CLion run C code?

In CLion, you can use GCC-based compilers, Clang, Clang-cl, Visual Studio C++ compiler, as well as IAR compiler and custom-defined compiler.

How do I run a program on CLion C?

From the main menu, select Run | Show Running List. In the top-right corner of the editor, CLion shows a list with all active applications.

Can CLion compile C?

CLion bundles a version of the MinGW toolset for quick setup. The exact version bundled is MinGW-w64 9.0 with languages=c,c++ , posix threads, and seh exceptions. You can use this bundled toolchain or switch to a custom MinGW installation.


2 Answers

To elaborate on the answer provided by "uta" you need either MinGW or Cygwin in order to compile your code. MinGW can be obtained from here: MinGW

Or Cygwin from here: Cygwin

For simplicity I will describe MinGW. Install MinGW then navigate like so in CLion:

File -> Settings -> Build, Execution, Deployment -> Toolchains

And select the directory you have MinGW installed. I believe by default on Windows it's C:\MinGW. Once you've done this CLion will scan the directory and detect it.

If you already have them installed then you need only select the folders they're installed in in CLion.

Hope this helps.

like image 189
Quantum Avatar answered Oct 20 '22 17:10

Quantum


Please, start from menu: File | Settings... | Build, Execution,... | Toolchains | Environment:

like image 35
uta Avatar answered Oct 20 '22 17:10

uta