Code::Blocks
August 31, 2014, 10:14:31 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: The new Release 13.12 is out! You can download binaries for windows, mac and many major linux distros from  http://www.codeblocks.org/downloads/26 .
 
   Home   Help Search Login Register  :: WebsiteWiki  
Pages: [1] 2  All   Go Down
  Send this topic  |  Print  
Author Topic: Code::block how to support C++0x  (Read 9229 times)
hqt
Advanced newcomer
*
Offline Offline

Posts: 16


« 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 Smiley
Logged
oBFusCATed
Developer
Lives here!
*****
Offline Offline

Posts: 7555


« Reply #1 on: November 14, 2011, 03:56:04 pm »

Search for TDM GCC 4.6.1.
Logged

<debugger plugin maintainer>
(most of the time I ignore long posts)
zabzonk
Guest
« 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.
Logged
thomas
Administrator
Lives here!
*****
Offline Offline

Posts: 3938



« 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).
Logged

"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."
hqt
Advanced newcomer
*
Offline Offline

Posts: 16


« 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 Smiley
Logged
oBFusCATed
Developer
Lives here!
*****
Offline Offline

Posts: 7555


« Reply #5 on: November 16, 2011, 09:35:59 am »

Read this: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29
Logged

<debugger plugin maintainer>
(most of the time I ignore long posts)
zabzonk
Guest
« 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.
Logged
hqt
Advanced newcomer
*
Offline Offline

Posts: 16


« 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 Sad

@: 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 Smiley
« Last Edit: November 17, 2011, 08:25:03 am by hqt » Logged
oBFusCATed
Developer
Lives here!
*****
Offline Offline

Posts: 7555


« 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"
Logged

<debugger plugin maintainer>
(most of the time I ignore long posts)
zabzonk
Guest
« 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.
Logged
hqt
Advanced newcomer
*
Offline Offline

Posts: 16


« 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 Smiley
Logged
zabzonk
Guest
« 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.
Logged
oBFusCATed
Developer
Lives here!
*****
Offline Offline

Posts: 7555


« 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.
Logged

<debugger plugin maintainer>
(most of the time I ignore long posts)
zabzonk
Guest
« 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.
Logged
oBFusCATed
Developer
Lives here!
*****
Offline Offline

Posts: 7555


« 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?
Logged

<debugger plugin maintainer>
(most of the time I ignore long posts)
Pages: [1] 2  All   Go Up
  Send this topic  |  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!