Does anyone use testlib on cygwin + g++?
It gives a compilation error at the 434th line:
_setmode(_fileno(file), O_BINARY);
``
I know two ways to fix this issue:
Comment out the 434th line. However, it disables this line and I'm not sure whether this is a good way.
Add <io.h> to testlib. However, it works only on Windows.
How to fix the compilation error in a better way?
"However, it works only on Windows."
What other platforms do you need Cygwin to work on?
What about using
ifdef
to only inlclude it on Windows?Like:
MSDN says that _setmode requires io.h. So it looks like the way to go.
Following purely MSDN in Cygwin might not be the best idea as it has it's own logic for handling binary and text files https://cygwin.com/cygwin-ug-net/using-textbinary.html#textbin-devel .
Testlib already includes <io.h> for windows except cygwin is somewhere between so current ifdefs probably don't detect it as such and you probably don't need to include other windows junk in cygwin.
Try using
-std=gnu++11
instead of-std=c++11
(or equivalent). It does the trick with my MinGW.I've made a fix. Can you try the latest 0.9.14 version from the https://github.com/MikeMirzayanov/testlib ?
Thank you, it works now.