Trouble with Code::Blocks and C++11 standard

Hello guys,

at first: I'm not completely sure if this is the right subforum, so please tell me if it's wrong and move it to the right section. And I'm German, so please excuse my bad English :)

I'm currently working on a Code::Blocks project with MinGW 4.9.2. Its aim is to easify Console and GUI programming by user defined functions. But that's not really relevant for my question. Here I'll post the build log and it's a bit strange, because I've enabled the -std=c++11 option. But another include file pops up and tells my I should set that option.

-------------- Build: Release in Olfibits-C++ (compiler: GNU GCC Compiler)---------------

g++.exe -pedantic -Wall -std=c++11 -std=gnu++11 -O2 -pedantic -Wall -std=c++11 -pedantic -Wall -std=c++11 -ansi -c "C:\Users\Florian.FLORIAN\Olfibits Software Project\Projects\Olfibits-C++\main.cpp" -o obj\Release\main.o
In file included from C:/Program Files (x86)/CodeBlocks/MinGW/lib/gcc/mingw32/4.9.2/include/c++/array:35:0,
from C:\Users\Florian.FLORIAN\Olfibits Software Project\Projects\Olfibits-C++\includer.h:24,
from C:\Users\Florian.FLORIAN\Olfibits Software Project\Projects\Olfibits-C++\main.cpp:5:
C:/Program Files (x86)/CodeBlocks/MinGW/lib/gcc/mingw32/4.9.2/include/c++/bits/c++0x_warning.h:32:2: error: #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.
#error This file requires compiler and library support for the \
In file included from C:\Users\Florian.FLORIAN\Olfibits Software Project\Projects\Olfibits-C++\includer.h:34:0,
from C:\Users\Florian.FLORIAN\Olfibits Software Project\Projects\Olfibits-C++\main.cpp:5:
C:\Users\Florian.FLORIAN\Olfibits Software Project\Projects\Olfibits-C++\file.h: In function 'int FileGetsize(std::string)':
C:\Users\Florian.FLORIAN\Olfibits Software Project\Projects\Olfibits-C++\file.h:73:1: warning: no return statement in function returning non-void [-Wreturn-type]
C:\Users\Florian.FLORIAN\Olfibits Software Project\Projects\Olfibits-C++\file.h: In function 'std::vector<std::basic_string<char> > FileReadToArray(std::string)':
C:\Users\Florian.FLORIAN\Olfibits Software Project\Projects\Olfibits-C++\file.h:34:1: warning: control reaches end of non-void function [-Wreturn-type]
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 2 warning(s) (0 minute(s), 0 second(s))


The two warnings appear because one function (FileGetSize) returns nothing at the moment, although declarated that it should return an Integer value.
The other warning appears because in case of an error, there is no array created to return. So this function also returns nothing in case of a FileOpen error.

I would be glad to know what's wrong with the compiler- I don't have any idea. As you can see above, the -std=c++11 parameter is given to the compiler - but the file still opens. Rebooting system and restarting Code::Blocks didn't help. It also didn't help to backup the source files and create the project completely new in Code::Blocks. Maybe you can give me a hint.

If that helps: I've also installed another MinGW compiler version because of compatiblity with a C++ framework. But I've set the compiler settings back to the 4.9.2 settings.

Thanks for your help!
It looks like C::B has an older MinGW somewhere in its PATH. You will have to look through all your configuration options for anything that is a directory and make sure they don't have any paths except for your current compiler.

If your C::B is old, it is worth replacing it with the latest -- download the one bundled with the TDM-GCC compiler.

[edit] Old MinGWs can pop up in weird places. For example, make sure you don't have paths for things like old versions of Perl or the like either. [/edit]

Good luck!
Last edited on
To get you current paths you can use this little demo.
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>

using namespace std;

int main() 
  char *tmp = getenv("PATH");
  if (tmp)
    string line;
    stringstream ss(tmp);
    while (getline(ss, line, ';'))
      cout << line << "\n";
    cout << "No path variable set";

  return 0;
Those kind of problems tend to appear every once in a while and it's important to cover it as quick as you can as if you don't it might make some bugs in your code. Of course, you can always detect and solve those with programs like chekcmarx but it's recommended to avoid it as much as possible.
Good luck.
It wasn't the fault by "PATH" - don't know why it didn't work. I just reinstalled Code::Blocks and now it works. Thanks :-)
It isn't the OS PATH that was the issue, but C::B's PATHs.

In any case, I'm glad you've got it fixed and working with the latest and greatest.
Oh, it was the Code::Blocks path you meant... OK, that explains why it worked after reinstallation.
I've marked that thread as SOLVED.
Topic archived. No new replies allowed.