Jump to content

Currently using CodeBlocks with GNU GCC Compiler. How to enable C++0x/C++11?

 

Currently experimenting with threads and mutex but I can't seem to enable this feature, my compiler says:

#ifndef __GXX_EXPERIMENTAL_CXX0X__#error This file requires compiler and library support for the \ISO C++ 2011 standard. This support is currently experimental, and must be \enabled with the -std=c++11 or -std=gnu++11 compiler options.#endif

| CPU: Ryzen 5 3600 | MoBo: MSI B450 Tomahawk Max | RAM: T-Force Delta RGB (2x8) 16GB 3200MHz (Black) | GPU: Gigabyte GTX 1660 Ti OC | Case: NZXT H500 (Black) | HDD: WD Black 2TB + Seagate Barracuda 4TB | SSD: Crucial MX500 2TB | PSU: Seasonic GX-550 | Monitor: 3x Asus VC239H |

 

 

Link to comment
https://linustechtips.com/topic/227231-how-to-enable-c0xc11/
Share on other sites

Link to post
Share on other sites

1) i was never able to enable c++11 on Code::Blocks

2) there is an option (in the build options, iirc) to use c++11

3) it didn't do anything for me, maybe it will for you

 

it didn't do anything for me either :( There's this "Have g++ follow the C++11 ISO C++ Language Standard [ -std=c++0x ], ticked it and does nothing

std::mutex mtx; // not recognized

and

mutex mtx; // didn't work either

| CPU: Ryzen 5 3600 | MoBo: MSI B450 Tomahawk Max | RAM: T-Force Delta RGB (2x8) 16GB 3200MHz (Black) | GPU: Gigabyte GTX 1660 Ti OC | Case: NZXT H500 (Black) | HDD: WD Black 2TB + Seagate Barracuda 4TB | SSD: Crucial MX500 2TB | PSU: Seasonic GX-550 | Monitor: 3x Asus VC239H |

 

 

Link to comment
https://linustechtips.com/topic/227231-how-to-enable-c0xc11/#findComment-3112218
Share on other sites

Link to post
Share on other sites

It depends on what version of GCC/g++ you're using. If you're using an older version (pre 4.8, IIRC), it's likely that the standard library that ships with GCC doesn't support the multithreading libraries in C++11's STL. Check which version of GCC is installed and reply back here. Also, tell me what operating system you're using.

Link to comment
https://linustechtips.com/topic/227231-how-to-enable-c0xc11/#findComment-3122433
Share on other sites

Link to post
Share on other sites

It depends on what version of GCC/g++ you're using. If you're using an older version (pre 4.8, IIRC), it's likely that the standard library that ships with GCC doesn't support the multithreading libraries in C++11's STL. Check which version of GCC is installed and reply back here. Also, tell me what operating system you're using.

 

 

4.7.1, Windows 8.1 x64, I guess I need to update my GCC

| CPU: Ryzen 5 3600 | MoBo: MSI B450 Tomahawk Max | RAM: T-Force Delta RGB (2x8) 16GB 3200MHz (Black) | GPU: Gigabyte GTX 1660 Ti OC | Case: NZXT H500 (Black) | HDD: WD Black 2TB + Seagate Barracuda 4TB | SSD: Crucial MX500 2TB | PSU: Seasonic GX-550 | Monitor: 3x Asus VC239H |

 

 

Link to comment
https://linustechtips.com/topic/227231-how-to-enable-c0xc11/#findComment-3125722
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×