I've searched some similar questions,like Clion can't resolve c++11 std types, and did as the asker did, but the Clion still unrecognized the std variables, and asked me to use std::string instead of string. This can be resolved by adding using namespace std at the top of a file, but I don't like to add this code in every file, so how can I resolve this problem? this is my CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(myapp)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include_directories(".")
set(HeadFileDirList "")
file(GLOB SRCH_LIST comm2/*.h comm2/*/*.h comm2/*/*/*.h comm2/*/*/*/*.h comm2/*/*/*/*/*.h mmcomm/*.h mmcomm/*/*.h mmcomm/*/*/*.h mmcomm/*/*/*/*.h mmcomm/*/*/*/*/*.h)
foreach(src ${SRCH_LIST})
string(REGEX REPLACE "[^/\\\\]+$" "" HeadFileDir ${src})
message(STATUS ${HeadFileDir})
include_directories(${HeadFileDir})
endforeach()
add_executable(myapp main.cpp)
and this is Clion error clion error
Aucun commentaire:
Enregistrer un commentaire