Author Topic: updation compiler version  (Read 2511 times)

Offline maxcy

  • Multiple posting newcomer
  • *
  • Posts: 20
updation compiler version
« on: July 16, 2023, 06:36:50 pm »
Newby to this IDE! I am fooling around with <string_view> so I need to update to a much newer compiler to get this library to work. I finally got the newest compiler version downloaded and extracted into a folder. I noticed that this IDE has a MinGW folder to use it's compiler. I would like to know if all I have to do is copy and paste the new MinGW folder over the existing one in this IDE setup?  In DevC++ I have to add in the new compiler in it's compiler setup menu. I don't see anything like this in this IDE, but would like to make sure before I screw something up!
maxcy / wt1v

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: updation compiler version
« Reply #1 on: July 16, 2023, 07:54:44 pm »
Newby to this IDE! I am fooling around with <string_view> so I need to update to a much newer compiler to get this library to work. I finally got the newest compiler version downloaded and extracted into a folder. I noticed that this IDE has a MinGW folder to use it's compiler. I would like to know if all I have to do is copy and paste the new MinGW folder over the existing one in this IDE setup?  In DevC++ I have to add in the new compiler in it's compiler setup menu. I don't see anything like this in this IDE, but would like to make sure before I screw something up!
maxcy / wt1v

DO NOT COPY THE FILES OVER THE ONES IN THE MINGW FOLDER!

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline maxcy

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: updation compiler version
« Reply #2 on: July 16, 2023, 10:11:42 pm »
main.cpp (attached) will not compile. The version of g++ that is in the CodeBlock compiler is 8.1.0 and the new compiler that I installed is 13.1.0. So the string_view library is not being found by the old compiler.  I did try to install a new compiler version! Attached (globalcompilersettings) is the compiler setting that I made in accordance to the documentation on using a new compiler!  In the compiler list I have in the toolChain Executables tab, GNU GCC compiler selected, and you can see the path to the new compiler folder on the C drive. If I select a different compiler from the list, the path to a new folder shows up, so it is safe to think that the folder to the new compiler is OK! But the old compiler is still being used when I go back and compile this code!  How do I get this IDE to recognize the new compiler and not use the old one?  It took me 5 minutes to do this same task when I used my DevC++, but this IDE is very frustrating when trying to do such a simple task!
naxcy / wt1v

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: updation compiler version
« Reply #3 on: July 17, 2023, 12:51:59 am »
Set the compiler installation directory to the value of the new one you installed.

Edit: If you installed the C::B without the MINGW compiler, it might find the new compiler by clicking on auto detect; but, I am guessing CB would take the one in the mingw sub-folder if it exists. Note: Deleting the CB mingw sub-folder might bring back that ability; but, it fails to find the new compilers alot of the time.

Edit2: https://wiki.codeblocks.org/index.php/Installing_a_supported_compiler

Tim S.
« Last Edit: July 17, 2023, 01:08:14 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline maxcy

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: updation compiler version
« Reply #4 on: July 17, 2023, 06:37:55 am »
When I first tried CB all was well until I tried to use an example that used the string_view example.  I downloaded and  installed the new compiler, version 13.1.0 to fix this problem.  I can see the path to new minGW folder when I select it from the compiler list, so I know that it got installed.  However, when I go to use the new g++ when I actually make a compilation, it still uses the old version in the CB directory!  I'm going to go back into the CB directory for minGW and rename it (keeping it for backup in case I need to undo my experiment) so the IDE can no longer find it and try this example once again.  If it still happens my only conclusion is that the version 13.1.0 g++ is not new enough!? I do appreciate any help on this quagmire. BTW I have tried auto detect and did not see any response. maxcy / wt1v

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5493
Re: updation compiler version
« Reply #5 on: July 17, 2023, 10:54:10 am »
can you specify what is the path where you installed the gc113 ?

Offline gd_on

  • Lives here!
  • ****
  • Posts: 797
Re: updation compiler version
« Reply #6 on: July 17, 2023, 11:22:57 am »
Do you execute the program from inside code::blocks or as a standalone one ?
From inside (green arrow at the top, or submenu Build/Run, or Ctrl-F10) it should work with gcc 13.1 as shown in your configuration. (It works for me, so gcc 13.1 is OK).
As standalone, running directly your .exe, you can have a problem if your Windows main PATH contains the old compiler path. C:\MingW64\bin should appear before the old compiler path (because your program need to know where is the right dll version of libstdc++-6.dll).

PS : for your information, it's also OK with gcc 8.1 but you have to force C++17 compatibility (at least) in the compiler options (as indicated in the journal during compile and link).
« Last Edit: July 17, 2023, 12:09:46 pm by gd_on »
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline maxcy

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: updation compiler version
« Reply #7 on: July 17, 2023, 06:23:14 pm »
I did rename the minGW folder in CB so it cannot be used, then I compiled and ran the project again and got the same results!  So CB is not using the CB compiler.  I am compiling and running the exe from within CB! You saw my setup and we both agree that it is OK, but my IDE doesn't not work and yours does! Frustrating to say the least!!! I did check the path variable and I can see that my new minGW folder is at the end of a long list that uses minGW, so I'm going to move it to the front and try running the exe from the cmd window! At least that will prove the compiler and the exe are OK. I'll check back tomorrow on this issue.
maxcy / wt1v

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline maxcy

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: updation compiler version
« Reply #9 on: July 18, 2023, 10:33:52 pm »
After much monkeying around I finally got this thing working! But then I decided to use the debugger. The debugger after I looked at how it was used was very different than in the old version compiler. I used to go into the debug tab at the bottom of the IDE and find all the tabs I needed to run/stop and set watches.  Not so in this new interface! At first all it showed was the debugger was not found, so I went into the debugger setting and set a path to the dgb.exe file and recompiled it. Still the same error message was shown, but I could see me making break points.  I finally figured out that I had to clear the debugger window and recompile. Now everything was OK! I now found that all the debugger commands were at the top menu. So now everything looks OK!!!  Thanks for the help!
maxcy / wt1v