Qt Creator: no member named 'ranges' in namespace 'std'
-
Hi guys
I have 'visual' problem in Qt Creator. Qt Creator marks std::ranges with above error message however I can build and run program. I use gcc version 10.1.1 20200507 (Red Hat 10.1.1-1) (GCC)
Do you know how to fix it?Regards
Slawek -
Hi,
yes, I have <ranges> in Playground.h file - I forgot to move it to Playground.cpp but even when I move it to cpp file there is still error message.
I opened this project under Clion IDE and it's ok.#ifndef PLAYGROUND_H #define PLAYGROUND_H #include <iostream> #include <ranges> class Playground { public: void showABCWithRange(); }; #endif // PLAYGROUND_H
-
Proof:
#include <iostream> #include <ranges> #include "Playground.h" void Playground::showABCWithRange() { std::cout << std::ranges::size("ABC") << "\n"; }
Process Error: 5 Output: /home/slawtul/sources/Cpp_tools/Playground_lib/Playground.cpp:7:21: error: no member named 'ranges' in namespace 'std' std::cout << std::ranges::size("ABC") << "\n"; ~~~~~^ 1 error generated. 11:28:42: Error: Failed to analyze 1 files.
-
Proof:
#include <iostream> #include <ranges> #include "Playground.h" void Playground::showABCWithRange() { std::cout << std::ranges::size("ABC") << "\n"; }
Process Error: 5 Output: /home/slawtul/sources/Cpp_tools/Playground_lib/Playground.cpp:7:21: error: no member named 'ranges' in namespace 'std' std::cout << std::ranges::size("ABC") << "\n"; ~~~~~^ 1 error generated. 11:28:42: Error: Failed to analyze 1 files.
-
Hi
I mentioned in the first post that program builds and runs - both from terminal and from Qt Creator.Below few lines from CMakeList.txt:
cmake_minimum_required(VERSION 3.15) project(Cpp_tools) set(CMAKE_CXX_STANDARD 20) add_compile_options(-Wall -Wextra -Wpedantic -Werror)
Do I need to enable 'something else' in Qt Creator to get ride of this error message?
From my konsole:
[slawtul@localhost ~]$ gcc -v gcc version 10.1.1 20200507 (Red Hat 10.1.1-1) (GCC) [slawtul@localhost ~]$ clang -v clang version 10.0.0 (Fedora 10.0.0-2.fc32)
Thanks!
Slawek -
Hi
I mentioned in the first post that program builds and runs - both from terminal and from Qt Creator.Below few lines from CMakeList.txt:
cmake_minimum_required(VERSION 3.15) project(Cpp_tools) set(CMAKE_CXX_STANDARD 20) add_compile_options(-Wall -Wextra -Wpedantic -Werror)
Do I need to enable 'something else' in Qt Creator to get ride of this error message?
From my konsole:
[slawtul@localhost ~]$ gcc -v gcc version 10.1.1 20200507 (Red Hat 10.1.1-1) (GCC) [slawtul@localhost ~]$ clang -v clang version 10.0.0 (Fedora 10.0.0-2.fc32)
Thanks!
Slawek