Author Topic: Advice needed on which Code::Blocks for C++17 and related subjects  (Read 4120 times)

Offline dane37

  • Single posting newcomer
  • *
  • Posts: 2
Advice needed on which Code::Blocks for C++17 and related subjects
« on: September 05, 2020, 04:51:28 pm »
Hi, I'm a novice running Code::Blocks 17.12 with compiler settings for C++14. The compiler settings in my version refer to C++17 as "coming".  I want to access the Windows 10 file directory and a bit of research leads me to believe that I should do so with C++17 or if that is not available then Boost. I have a few questions: 1. Should I install Code::Blocks 20.03 binaries? 2. If so, do I run setup.exe "on top of" 17.12 (without uninstalling 17.12)? 3. Does 20.03 include support for C++17? The Boost website has a nice tutorial on its filesystem library that includes examples available for download. I understand the C++17 filesystem library came from Boost. 4. Is working through the Boost tutorial the simplest way to learn the C++17 filesystem library or is there somewhere else I should look? 5. Do you have any other advice about these subjects? Thanks in advance, Dane

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Advice needed on which Code::Blocks for C++17 and related subjects
« Reply #1 on: September 05, 2020, 07:25:45 pm »
Hi, welcome to the forum

Codeblocks is not a compiler, but an IDE, it can work with many different versions of compilers. For convenience we ship a compiler. For 17.12 it was probably gcc 4.5...
If you want some recent compiler you can download it for example from here https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe

Install the new compiler in some directory, and point codeblocks to it:
1) Start codeblocks
2) Settings -> Compiler ->Toolchain executables-> Compiler installation direcotry -> point it to the bin firectory of your new installation of the compiler
3) You may have to fix the executable names from the Program Files at the bottom
Code
C compiler -> x86_64-w64-mingw32-gcc.exe
C++ compiler -> x86_64-w64-mingw32-g++.exe
linker for dynamic libs -> x86_64-w64-mingw32-g++.exe

Now if you also want to debug, you have to point also the debugger to the new version
Settings->Debugger->Default->Executable path-> Point it to the gdb.exe in the bin directory of the new installed compiler

Now if you want to use c++17 you can
1) create a new project.
2) Project->Build options->Select your project name on the left->Compiler flags-> Select the c++17 flag, or add "-std=c++17" in other compiler options

et voilĂ  you have the newest compiler with your current codeblocks version

For your other questions... This is the wrong forum to ask.
We support only questions about codeblocks, and not about general c++ things :)

greetings

Offline dane37

  • Single posting newcomer
  • *
  • Posts: 2
Re: Advice needed on which Code::Blocks for C++17 and related subjects
« Reply #2 on: September 05, 2020, 07:59:49 pm »
That is very helpful. Thank you for a prompt, detailed and friendly response.