User forums > Help
how to compile c++11 code
(1/1)
yuvadius:
ok so i started reading a book and it has a section with c++11 features in it.
when i try copy paste the code i get errors.
for example i want to compile this code.
and dont worry i included all headers and those type of stuff.
std::vector<double> vec;
for ( auto& elem : vec )
{
elem *= 3;
}
but i get all sort of compiler errors.
i google'd this topic and found that i have to turn the flag "-std=c++0x" on,threw progect -> build options
or compiler and debugger.
so i did just that and i still have errors in my code.
i think its because im using the compiler gcc(version 4.4.1 or something like that)
and i need i newer version of gcc compiler.
i tried to install it but it destroyed my codeblocks settings so i had to reinstall codeblocks.
so my compiler can't compile c++11 code.
please help me compile this code.
MortenMacFly:
--- Quote from: yuvadius on August 07, 2012, 05:02:37 pm ---please help me compile this code.
--- End quote ---
Install a and setup an appropriate compiler, like GCC/TDM (google for it).
yuvadius:
im a noob i don't know how
stahta01:
--- Quote from: yuvadius on August 07, 2012, 05:16:19 pm ---im a noob i don't know how
--- End quote ---
I would suggest using Google to learn to Google; but, I think you would not find it funny.
Read the CB FAQs maybe one will help you.
http://wiki.codeblocks.org/index.php?title=FAQ
Read the CB User Docs
http://wiki.codeblocks.org/index.php?title=User_documentation
http://support.google.com/websearch/bin/answer.py?hl=en&answer=134479
http://tdm-gcc.tdragon.net/
Tim S.
Navigation
[0] Message Index
Go to full version