Author Topic: Updating GCC  (Read 5793 times)

Offline Jc6828

  • Single posting newcomer
  • *
  • Posts: 8
Updating GCC
« on: October 10, 2011, 10:54:08 am »
I am using Code::Blocks 10.05

Can you tell me where I can find the version of GCC that came with it and if it is 4.5 how I can update to 4.6.

I ask this as when I use in C++
array<int,13> monthdays = { 29, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
I get an error that the braces are missing and have to put another set round as follows
array<int,13> monthdays = {{ 29, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }};

According to the C++ Forum this has been fixed in GCC >4.6

I appreciate this is a pretty small thing but would like to know how to upgrade anyway for future reference.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Updating GCC
« Reply #1 on: October 10, 2011, 11:09:07 am »
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jc6828

  • Single posting newcomer
  • *
  • Posts: 8
Re: Updating GCC
« Reply #2 on: October 10, 2011, 11:28:46 am »
I have looked at that topic and have downloaded the 32bit version.

When I try to install it I selected manage an existing version but when I clicked through to c/program files/code::blocks/mingw it would not allow me to select the mingw folder.

So Itried a new isntallation and again when I clicked through to the mingw folder it said ' do you really want to use this older it isn't empty'.

This worried me so I stopped at that point and came back here to ask your advice.

Should I uninstall the original mingw before installing the new one and if so will Code::Blocks then use it automatically?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Updating GCC
« Reply #3 on: October 10, 2011, 11:44:26 am »
Should I uninstall the original mingw before installing the new one and if so will Code::Blocks then use it automatically?
Yes and no.
Uninstall the previous version and after installing the new one go to "Setup  -> Compiler and debugger -> Gnu GCC compiler -> Toolchain executables" and try the autodetection, if that does not work set the compilers installation path manually and make sure the executables have the correct names.

Offline Jc6828

  • Single posting newcomer
  • *
  • Posts: 8
Re: Updating GCC
« Reply #4 on: October 10, 2011, 11:49:17 am »
Thanks for that.

However it appears that I can only uninstall the whole Code::Blocks installation not just the mingw part.

If I do that and download a new Code::Blocks and re-install that will that include the latest version of GCC or will it still be the same as the one I am currently using.

You may gather from these questions I am not completely au fait with setting up applications on Windows but generally just follow the default prompts - and you would gather correctly!!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Updating GCC
« Reply #5 on: October 10, 2011, 11:52:05 am »
If I do that and download a new Code::Blocks and re-install that will that include the latest version of GCC or will it still be the same as the one I am currently using.
We have a windows installer,  which includes Mingw in it just for convenience.
We don't update the installer when a new MinGW is released.

p.s. you don't have to uninstall the old compiler, just change the config in the global options.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jc6828

  • Single posting newcomer
  • *
  • Posts: 8
Re: Updating GCC
« Reply #6 on: October 10, 2011, 12:14:55 pm »
What I have done is delete the contents of the mingw folder and then installed using tdm-gcc-4.6.1.exe into that folder.

Code:Blocks runs OK and appears to compile OK but I still get the error referred to in my original post if I only use a single pair of braces.

Is there any way I can ask Code::Blocks to tell me the version of GCC it is using as this error was supposed to have been fixed in GCC 4.6?

zabzonk

  • Guest
Re: Updating GCC
« Reply #7 on: October 10, 2011, 12:29:33 pm »
I can confirm that the problem is fixed in GCC 4.6 - just tried it with the TDM build. It sounds like you still have the old GCC installed. I would recommend installing TDM GCC in a folder completely unrelated to CodeBlocks, and check that your code works from the command line. I have  a blog article on how to do this at http://latedev.wordpress.com/2011/06/20/how-to-install-a-c-compiler-on-windows - then, once you have it compiling from the command line, integrate it into CB via the toolchain dialog.

BTW, a tool I have found extremely handy for resolving issues like this is Everything, free at http://www.voidtools.com - you can easily find all copies of GCC  using this, which might be more than you would be expecting - several other tools install their own copies of GCC.
« Last Edit: October 10, 2011, 12:44:49 pm by Neil Butterworth »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Updating GCC
« Reply #8 on: October 10, 2011, 12:31:40 pm »
According to the C++ Forum this has been fixed in GCC >4.6
'>' or '>='?

To see the version of gcc, open a terminal and cd to the folder with your installation and execute "gcc --version" or "g++ version".
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jc6828

  • Single posting newcomer
  • *
  • Posts: 8
Re: Updating GCC
« Reply #9 on: October 10, 2011, 01:05:06 pm »
Thanks Neil and oBFusCATed

oBFusCATed I tried running "gcc --version" and it told me GCC 4.6.1 so it seems OK from that point of view.

Neil thanks for your info; I will try your suggestion when I have more time. The program does run OK, it is only a warning about the braces so for now I will live with it as, as seems common with Windows since I changed from ARM machines, I seem to spend more time housekeeping and getting the machine to do what I want it to do rather than what microsoft seem to want it to do. Maybe Linux is calling more loudly than before!!

But thanks to all who helped me, it is appreciated.