2017-04-03 2 views
1

"JetBrains CLion 2017.1"을 사용하여 C++ 11을 기반으로하는 멀티 스레딩 프로그램을 작성하고 있습니다.CLion이 스레드를 해결할 수 없습니다.

#include <stdlib.h> 
#include <iostream> 
#include <thread> 

void thread_task() { 
    std::cout << "hello thread" << std::endl; 
} 

int main(int argc, const char *argv[]) 
{ 
    std::thread t(thread_task); 
    t.join(); 

    return EXIT_SUCCESS; 
} 

그리고 "CMakeLists.txt은"기본값입니다 : 코드는 여기에

cmake_minimum_required(VERSION 3.7) 
project(AgileDev) 

set(CMAKE_CXX_STANDARD 11) 

set(SOURCE_FILES main.cpp) 
add_executable(AgileDev ${SOURCE_FILES}) 

그러나 CLion는 "스레드"해결할 수없는 : 나는 궁금 enter image description here

오류 사진을 어디 틀 렸습니다. (T^T)

+1

다음 작업을해야하지만 유사한 문제에 직면 할 수 콜드 : http://stackoverflow.com/questions/32184177/c-error-type-stdthread-could -not-be-resolved-eclipse-mars-4-5-우분투 -12 –

답변

1

나는 똑같은 오류가있었습니다. 분명히 mingw를 사용한다면 표준 쓰레드를 지원하지 않는다. 이 파일을 다운로드해야합니다 : https://github.com/meganz/mingw-std-threads

mingw.mutex.hmingw.thread.h을 프로젝트 디렉토리에 추가하십시오.이 파일을 cpp 소스 파일의 맨 위에 추가하십시오.

#include "mingw.thread.h" 

그것은이 링크는 일식입니다