Standard C++ library is not found
I have come into the situation where launching CLion with `LC_ALL=C LANG=en_US.UTF-8` doesn't work for this problem, so I'm rather seeking help here.
CLion cannot find the standard library of C++17 in src/constants.hpp, as shown: https://owo.whats-th.is/ed9ae8.png
The following is my CMakeLists.txt:
```cmake
cmake_minimum_required(VERSION 3.10)
project(name C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(PROJECT_SOURCE_DIR src)
add_library(name STATIC ${PROJECT_SOURCE_DIR})
set_target_properties(name PROPERTIES LINKER_LANGUAGE CXX)
target_compile_options(name PUBLIC "-std=c++17 -Wall")
target_compile_features(name PUBLIC cxx_std_17)
target_include_directories(name PUBLIC ${PROJECT_SOURCE_DIR})
set(CPACK_PACKAGE_NAME "name")
set(CPACK_PACKAGE_VERSION "1.0.0")
set(CPACK_MONOLITHIC_INSTALL 1)
include(CPack)
```
I know for a fact it has been reloaded properly, it uses the bundled CMake and all other dependencies are present. It compiles fine with `cmake . && make`, even inside CLion with Run -> Build, but does not seem to find anything.
With the standard CLion directory structure, it doesn't work, either, so it is not the `src` directory's fault.
请先登录再写评论。
Hi! On my side #include <cstdlib> and #include <stdexcept> are not marked as not found.
Could you please create a new default "Hello, World!" project and check whether it works in it?
Also please provide some additional information: OS, CLion version, compiler which is used and its version.
OS: Arch Linux (uname -a: Linux proximyst 4.15.8-1-ARCH #1 SMP PREEMPT Sat Mar 10 00:00:33 UTC 2018 x86_64 GNU/Linux)
Compilers & tools: gcc, g++, cmake, gnu make,
CLion help data (Launched using JetBrains Toolbox):
CLion 2018.1 EAP
Build #CL-181.4203.106, built on March 14, 2018
CLion EAP User
Expiration date: April 13, 2018
JRE: 1.8.0_152-release-1136-b20 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.8-1-ARCH
The default executable template from the New Project menu works nicely.
When I changed it up by moving main.cpp into src/ and used this CMake config, it also worked nicely:
cmake_minimum_required(VERSION 3.10)
project(hellocpp C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(PROJECT_SOURCE_DIR src)
file(GLOB_RECURSE sources ${PROJECT_SOURCE_DIR}/*.c*)
add_executable(hellocpp ${sources})
set_target_properties(hellocpp PROPERTIES LINKER_LANGUAGE CXX)
target_compile_options(hellocpp PUBLIC -std=c++17 -Wall)
target_compile_features(hellocpp PUBLIC cxx_std_17)
target_include_directories(hellocpp PUBLIC ${PROJECT_SOURCE_DIR})
I therefore I cannot assume that you've fixed the issue and I'll rather just need to recreate my project and move files, and again be good to go.
If you manage to create a simple sample project with which the issue can be stably reproduced, please send it to clion-support at jetbrains.com.
I have also met this problem. The CMakeLists.txt is as follows:
After adding the final statement, the external libraries were missing.
OS: macOS 10.13.3
CLion Version: 2017.3.4
@CC could you please send a sample project to clion-support at jetbrains.com?