Struggling to import C++ project


I am using the latest version of CLion on Windows.

My CLion toolchain and CMake settings are as follows:


This all works fine when I create a new CMake project from scratch. But I run into problems when I import a C++ project and click the "Create a CMakeLists.txt" button.

My CMakeLists.txt file is:

cmake_minimum_required(VERSION 3.13)  # CMake version check
project(GraphLib) # Create project "simple_example"
set(CMAKE_CXX_STANDARD 14) # Enable c++14 standard

# Add main.cpp file of project root directory as source file
set(SOURCE_FILES main.cpp)

# Add executable target with source files listed in SOURCE_FILES variable
add_executable(GraphLib ${SOURCE_FILES})

When I build I get the following error message:

====================[ Build | GraphLib | Debug ]================================
"C:\Program Files\JetBrains\CLion 2022.1.3\bin\cmake\win\bin\cmake.exe" --build C:\Users\Lenovo\Documents\dev\GraphLib\cmake-build-debug --target GraphLib -- -j 6
[ 50%] Building CXX object CMakeFiles/GraphLib.dir/main.cpp.obj
In file included from C:\Users\Lenovo\Documents\dev\GraphLib\main.cpp:2:
C:\Users\Lenovo\Documents\dev\GraphLib\Graph.h:27:14: error: 'unordered_map' in namespace 'std' does not name a template type
         std::unordered_map<VertexID, VertexEdgeMapping> mEdges;

When I compile my code outside of CLion (just using g++) it works fine. The above error messages seem like a compiler error.


1 comment


Could you please try using the bundled MinGW toolchain on the `File | Settings | Build, Execution, Deployment | Toolchains` tab? Please choose it in the `Toolset` field. Does that help?


Please sign in to leave a comment.