Kenenbek Arzymatov
Kenenbek Arzymatov

Reputation: 9129

Clion. How to start C project?

I use Clion 2016.1 Clion creates project with CMakeLists.txt and main.c:

The content of CMakeLists.txt is:

cmake_minimum_required(VERSION 3.4)
project(Fir)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")

set(SOURCE_FILES main.c)
add_executable(Fir ${SOURCE_FILES})

The content of main.c is:

#include <stdio.h>

int main(void) {
    printf("Hello, world");
    getchar();
    return 0;
}

enter image description here

But it gives:

Configuration is still incorrect. Do you want to edit it again?

How to properly declare configuration to run the project

Upvotes: 0

Views: 1690

Answers (1)

Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26637

It works for me, I make a new project, build it and choose the project name as executable with this cmake contents:

cmake_minimum_required(VERSION 3.5)
project(new)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.c)
add_executable(new ${SOURCE_FILES})

enter image description here

Upvotes: 1

Related Questions