Author Topic: Code::block how to support C++0x  (Read 25796 times)

Offline hqt

  • Multiple posting newcomer
  • *
  • Posts: 16
Code::block how to support C++0x
« on: November 14, 2011, 02:57:47 pm »
Code::Block newest version (I'm using newest version of Nightly Build) with Min GW Complier does not support C++0x. So, how can I update my complier, to use new feature of C++0x, who can tell me, please.

thanks :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::block how to support C++0x
« Reply #1 on: November 14, 2011, 03:56:04 pm »
Search for TDM GCC 4.6.1.
(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!]

zabzonk

  • Guest
Re: Code::block how to support C++0x
« Reply #2 on: November 14, 2011, 04:29:24 pm »
Latest GCC version for Windows is available from TDM at http://tdm-gcc.tdragon.net - note that you have to enable the C++11 features with the -std=c++0x command line option, or from the Project Build Options|Compiler Settings tab from within Code::Blocks.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Code::block how to support C++0x
« Reply #3 on: November 15, 2011, 11:10:23 am »
Adding -std=gnu++0x -U__STRICT_ANSI__ to any MinGW version newer than 4.5 (though 4.6 is obviously preferrable) gives the fewest nasty surprises (i.e. for example C headers will not break).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline hqt

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Code::block how to support C++0x
« Reply #4 on: November 16, 2011, 03:11:09 am »
I go to [Settings] [Complier] in GNU GCC Complier, have option: having g++ follow the coming C++Ox ISO C++ language standard [-std=c++0x]. After I checked it, I stll cannot use C++0x feature.
And, I have installed TDM, but don't know how to integrate to Code::Block IDE.

So, who can help me, please.
thanks :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
(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!]

zabzonk

  • Guest
Re: Code::block how to support C++0x
« Reply #6 on: November 16, 2011, 10:24:25 am »
@hqt

Firstly, check that you can build your code from the command line (i.e outside of Code::Blocks).

Then check that your CB toolchain settings are pointing at the up-to-date compiler - go to Settings|Compiler & Debugger, then go to the Toolchain Executables tab and make sure the path in the first field is pointing to the up-to-date TDM installation.

If you still can't compile, compile this simple program:

Code
int main() {
     auto x = 1;
}

and post the resulting build log here.

Offline hqt

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Code::block how to support C++0x
« Reply #7 on: November 17, 2011, 08:23:13 am »
@: My code has tested successfully on Microsoft Visual Studio 2010, which supported C++0x.
I have installed newest TDM installation. For example, in D:\C++0x\
 a) I go to toolchain Executables tab and typing above path. (and I have tried D:\C++0x\bin\, too) But, when I compiled, nothing compiled yet, mean that Code::block doesn't recognize my installation, yet.
 b) If I use old version of MinGW, I still have option: [-std=c++0x] in Compiler Setting tab, but when I compiled, of course Compiler has error :(

@: for your program, when compile, It will have this error:  ISO C++ forbids declaration of 'x' with no type.  (of course !!!)

So, who give me some advice, please.
thanks :)
« Last Edit: November 17, 2011, 08:25:03 am by hqt »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::block how to support C++0x
« Reply #8 on: November 17, 2011, 10:24:41 am »
Do you use the correct compiler for you project?
You can check in "Project->Build options->Selected compiler"
(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!]

zabzonk

  • Guest
Re: Code::block how to support C++0x
« Reply #9 on: November 17, 2011, 10:30:44 am »
@hgt

Did you do this;

> Firstly, check that you can build your code from the command line (i.e outside of Code::Blocks).

If you can't get that to work, there is no point in messing with CB settings.

Offline hqt

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Code::block how to support C++0x
« Reply #10 on: November 17, 2011, 05:35:41 pm »
Quote
Do you use the correct compiler for you project?
I have checked and I'm using GNU C++. is it right ?

Quote
Firstly, check that you can build your code from the command line (i.e outside of Code::Blocks).
I don't know what you mean, but I have tested it on MS Studio 2010 successfully. And my program is very simple, it just tests feature of  C++0x. it just have one line:
Code
 void f_function(int&&a){} // this feature just has in C++0x

So, who can solve this problem for me, please.
thanks :)

zabzonk

  • Guest
Re: Code::block how to support C++0x
« Reply #11 on: November 17, 2011, 05:45:11 pm »
I can't believe that I have to explain to a programmer what a "command line" is. And I'm not going to.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::block how to support C++0x
« Reply #12 on: November 17, 2011, 05:45:42 pm »
I have checked and I'm using GNU C++. is it right ?
Is this the compiler you've setup to use the new version of MinGW(gcc)?

I don't know what you mean, but I have tested it on MS Studio 2010 successfully. And my program is very simple, it just tests feature of  C++0x. it just have one line:
It means that you should open a cmd.exe window and you should type some commands to compile your code, without an IDE.

p.s. I don't know if this is still true, but MinGW have hardcoded search paths like X:\mingw\ (x can be any of the drive letters)  and if you have other version of the compiler there it takes precedence.
   So you should make sure you have only one version of MinGW on your system.
(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!]

zabzonk

  • Guest
Re: Code::block how to support C++0x
« Reply #13 on: November 17, 2011, 05:51:35 pm »
You can have multiple versions of MinGW installed (I've currently got 5), but I agree for debugging the users problem getting rid of all but one would be a good idea.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Code::block how to support C++0x
« Reply #14 on: November 17, 2011, 05:55:41 pm »
Hm, I've not said that you can't have multiple versions of MinGW, have I?
(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!]