google / google/googletest

gtest-port.h fileno not declared in scope

Open
#813 20 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

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

Open the contributing guide

Research direction

Start by reproducing the supplied Cygwin/GCC command and inspect googletest/include/gtest/internal/gtest-port.h around FileNo, StrDup, and FDOpen. Treat the separate aggregate_test.hpp error at line 11 independently, and confirm that the reported compilation errors have a documented, reproducible resolution before considering the issue done.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.