I am trying to build my project over a cmake file. And started to get:
fatal error: string_view: No such file or directory
For the line below:
// Your First C++ Program
#include <string_view>
int main() {
std::cout << "Hello World!";
return 0;
}
I looked up in the internet, in stackoverflow question it is stated that this occurs because of the GCC version:String_view question.
I updated my gcc version as:
gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~16.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
But the problem is still here. I also using C++ 17 as below Cmake line:
cmake_minimum_required(VERSION 3.0)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
project (sample)
add_executable(
main
main.cpp
)
# Set include directories
include_directories(SYSTEM
)
# Set linked files
link_directories(
)
target_link_libraries(
main )
What could be the problem? Why cannot I compile the code?