Hello!
Installed codeblocks-20.03-32bit-mingw-32bit-setup.exe . In a simple program:#include <iostream>
#include <filesystem>
#include <map>
#include <string>
using namespace std;
namespace fs = filesystem;
int main()
{
setlocale(LC_ALL, "Russian");
map <string, unsigned int> map_ext;
for (const fs::directory_entry& dir_entry : fs::recursive_directory_iterator("N:\\TestProgramExt\\"))
{
if (fs::is_regular_file(dir_entry))
{
string ext = fs::path(dir_entry).extension().string();
++map_ext[ext];
}
}
for (auto&& [ext, num] : map_ext)
std::cout << ext << "\t" << num << std::endl;
std::cin.get();
return 0;
}I get errors when installing compilation options (C++2020 standard):-------------- Build: Debug in cbCppStudy (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -std=gnu++20 -c N:\MyProgramming\cppStudy\cppStudy.cpp -o obj\Debug\cppStudy.o
mingw32-g++.exe -o bin\Debug\cbCppStudy.exe obj\Debug\cppStudy.o
mingw32-g++.exe: error: unrecognized command line option '-std=gnu++20'; did you mean '-std=gnu++2a'?
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
-------------- Build: Debug in cbCppStudy (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -std=c++20 -c N:\MyProgramming\cppStudy\cppStudy.cpp -o obj\Debug\cppStudy.o
mingw32-g++.exe -o bin\Debug\cbCppStudy.exe obj\Debug\cppStudy.o
mingw32-g++.exe: error: unrecognized command line option '-std=c++20'; did you mean '-std=c++2a'?
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
This program compiles without errors in Visual Studio 2022, but I work more often in CodeBlocks.
Please help me solve the problem.
What's Your GCC Version? That's not related to CodeBlocks, but Your compiler. GCC, 10 and higher, have an acceptable support for C++20.
Thanks for the reply. The version of g++ 8.1 supplied in this distribution. Is it possible to make sure that the distribution includes the most modern version MinGW? In order not to look for the compiler in other places, but to use it immediately together with code blocks?
Thank you very much for the answer, I found a modern compiler and everything worked out. My suggestion to include a modern compiler in the distribution is stupid, because compiler versions change very quickly.
Quote from: tumanovalex on February 04, 2024, 10:12:51 AM
My suggestion to include a modern compiler in the distribution is stupid, because compiler versions change very quickly.
I don't think it's that stupid. A compiler that is actual at the time of release wouldn't be asking too much.
Quote from: user2024 on February 09, 2024, 11:16:14 PM
Quote from: tumanovalex on February 04, 2024, 10:12:51 AM
My suggestion to include a modern compiler in the distribution is stupid, because compiler versions change very quickly.
I don't think it's that stupid. A compiler that is actual at the time of release wouldn't be asking too much.
From https://gcc.gnu.org/releases.html (https://gcc.gnu.org/releases.html)
gcc 8.5 was released on May 14, 2021
Therefore, I think the question is not really a good one. Edit: ?8.1? was the version packaged by the third party at the time CB was getting ready for release. And, for good reason the do not wish to change it after the CB goes into something like a feature freeze used by other projects.
Edit: But, I have always maintained that releasing an Compiler with CB was not worth the effort; but, the CB Dev Team has maintained it is needed by the schools that choose CB.
Tim S.