bluemmb's blog

By bluemmb, 11 years ago, In English

Hello. When i try to use testlib with c++11 , arise this error :

In file included from test.cpp:7:0:
testlib.h: In function 'void __testlib_set_binary(FILE*)':
testlib.h:346:20: error: 'fileno' was not declared in this scope
 setmode(fileno(file), O_BINARY);
                    ^

Is compatible version released (couldn't find)? or Problem is removable easily ?

  • Vote: I like it
  • +8
  • Vote: I do not like it

| Write comment?
»
11 years ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

Try compiling it with -std=gnu++11 instead of =std=c++11.

  • »
    »
    11 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I was always wondering what is the difference between them? And what is the difference between C++0x and C++11?

    • »
      »
      »
      11 years ago, hide # ^ |
       
      Vote: I like it +1 Vote: I do not like it

      C++0x is an ancient name for C++11 — it was supposed to be finalized before 2010. This standard is now called C++11, so you'd better use it.

      gnu++11 (and gnu++03 as well) enables some GCC extensions to C++. As you can see, fileno is one of them.

  • »
    »
    9 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I am getting this error no matter what I set std as. :(

    Some help please? I use Cygwin on Windows.

»
11 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

I think that the latest testlib from trunk (0.9.9) can be compiled on C++11 without any issues.