error: 'fileno' was not declared in this scope

Big fan to the IDEs brought by JB, can't help to try CLion during EAP. Was trying to compile some code on Windows using Cygwin, got this error with gtest:

/usr/local/include/gtest/internal/gtest-port.h: In function 'int testing::internal::posix::FileNo(FILE*)':
/usr/local/include/gtest/internal/gtest-port.h:1741:51: error: 'fileno' was not declared in this scope
inline int FileNo(FILE* file) { return fileno(file); }

I googled it for a little bit and understand that I need to apply -std=gnu++0x rather than -std=c++0x when using g++ but since I'm not calling g++ directly but through CLion, not sure how am I supposed to do this. Anyone? Thanks.

Comment actions Permalink


You can define the required compiler flags using CMakeLists.txt or directly in cache via CMake tool window. You can find more details here.

Comment actions Permalink

Thanks Vyacheslav I did find and change the compiler flag in CMakeList.txt file, and that worked like a charm.


Please sign in to leave a comment.