带有Cygwin 1.7的GoogleTest 1.6:'fileno'未在此范围内声明
在Eclipse CDT中对Factorial()函数构建简单测试时出现错误消息:
Invoking: Cygwin C++ Compiler
g++ -std=c++0x -DGTEST_OS_CYGWIN=1 -I"E:\source\gtest-1.6.0\include" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/challenge.d" -MT"src/challenge.d" -o "src/challenge.o" "../src/challenge.cpp"
In file included from E:\source\gtest-1.6.0\include/gtest/internal/gtest-internal.h:40:0,
from E:\source\gtest-1.6.0\include/gtest/gtest.h:57,
from ../src/challenge.cpp:11:
E:\source\gtest-1.6.0\include/gtest/internal/gtest-port.h: In function 'int testing::internal::posix::FileNo(FILE*)':
E:\source\gtest-1.6.0\include/gtest/internal/gtest-port.h:1589:51: error: 'fileno' was not declared in this scope
E:\source\gtest-1.6.0\include/gtest/internal/gtest-port.h:1595:57: error: 'strdup' was not declared in this scope
E:\source\gtest-1.6.0\include/gtest/internal/gtest-port.h:1627:71: error: 'fdopen' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)
Eclipse CDT 8.1在Cygwin 1.7.22上运行gcc 4.7.3
gTest 1.6成功构建,包括演示测试,在Cygwin 1.7.22上使用cmake 2.8.9
我已经将构建的lib与完整路径链接起来,E:\ lib\gtest-1.6.0\Cygwin\libgtest.a
手动添加了以下命令选项,没有它就得到了相同的错误.
-DGTEST_OS_CYGWIN=1
Run Code Online (Sandbox Code Playgroud)
似乎错误与我的代码无关.有人在Eclipse和Cygwin中使用gTest吗? …