google/googletest

gtest-port.h fileno not declared in scope

Open

#813 opened on Jun 27, 2016

View on GitHub
 (20 comments) (0 reactions) (0 assignees)C++ (38,603 stars) (10,772 forks)batch import
help wanted

Description

I'm getting errors in gtest-port.h. Have tried various flags none are working.

Have searched and found similar errors, but no definitive solutions.

Any help is appreciated.

Thanks!

CYGWIN_NT-6.1 BaguaDragon 2.5.2(0.297/5/3) 2016-06-23 14:29 x86_64 Cygwin g++ (GCC) 5.4.0

g++ -static -std=c++0x -DGTEST_OS_CYGWIN=1 -pthread -MMD -c main.cpp -o build/main.o -I /home/ssi112/cpp/googletest-master/googletest -I /home/ssi112/cpp/googletest-master/googletest/include -I . -I ../src -I ../../class-library/include In file included from /home/ssi112/cpp/googletest-master/googletest/include/gtest/internal/gtest-internal.h:40:0, from /home/ssi112/cpp/googletest-master/googletest/include/gtest/gtest.h:58, from main.cpp:9: /home/ssi112/cpp/googletest-master/googletest/include/gtest/internal/gtest-port.h: In function ‘int testing::internal::posix::FileNo(FILE_)’: /home/ssi112/cpp/googletest-master/googletest/include/gtest/internal/gtest-port.h:2340:51: error: ‘fileno’ was not declared in this scope inline int FileNo(FILE_ file) { return fileno(file); } ^ /home/ssi112/cpp/googletest-master/googletest/include/gtest/internal/gtest-port.h: In function ‘char* testing::internal::posix::StrDup(const char_)’: /home/ssi112/cpp/googletest-master/googletest/include/gtest/internal/gtest-port.h:2346:57: error: ‘strdup’ was not declared in this scope inline char_ StrDup(const char* src) { return strdup(src); } ^ /home/ssi112/cpp/googletest-master/googletest/include/gtest/internal/gtest-port.h: In function ‘FILE* testing::internal::posix::FDOpen(int, const char_)’: /home/ssi112/cpp/googletest-master/googletest/include/gtest/internal/gtest-port.h:2374:71: error: ‘fdopen’ was not declared in this scope inline FILE_ FDOpen(int fd, const char* mode) { return fdopen(fd, mode); } ^ In file included from main.cpp:12:0: aggregate_test.hpp: In member function ‘virtual void AggregateTest_verifySplitAndFindAggregateFunctionality_Test::TestBody()’: aggregate_test.hpp:11:32: error: conversion from ‘void’ to non-scalar type ‘std::string {aka std::basic_string}’ requested std::string actual = aggregate(1, line); ^ make: *** [Makefile:28: build/main.o] Error 1

Contributor guide