[ 
https://issues.apache.org/jira/browse/THRIFT-5663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jens Geyer updated THRIFT-5663:
-------------------------------
    Summary: usleep was not declared in this scope  (was: lib: cpp: usleep was 
not declared in this scope)

> usleep was not declared in this scope
> -------------------------------------
>
>                 Key: THRIFT-5663
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5663
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>            Reporter: Christopher Friedt
>            Assignee: Christopher Friedt
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Several build failures in Travis resulted from an include-order problem in 
> TFileTransport.cpp.
> {code:java}
> libtool: compile:  g++ -std=c++11 -DHAVE_CONFIG_H -I/usr/include -I./src 
> -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Wall -Wextra -pedantic -g -O2 
> -MT src/thrift/transport/TFDTransport.lo -MD -MP -MF 
> src/thrift/transport/.deps/TFDTransport.Tpo -c 
> src/thrift/transport/TFDTransport.cpp -o src/thrift/transport/TFDTransport.o 
> >/dev/null 2>&1
> libtool: compile:  g++ -std=c++11 -DHAVE_CONFIG_H -I/usr/include -I./src 
> -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Wall -Wextra -pedantic -g -O2 
> -MT src/thrift/transport/TFileTransport.lo -MD -MP -MF 
> src/thrift/transport/.deps/TFileTransport.Tpo -c 
> src/thrift/transport/TFileTransport.cpp  -fPIC -DPIC -o 
> src/thrift/transport/.libs/TFileTransport.o
> In file included from ./src/thrift/Thrift.h:23:0,
>                  from ./src/thrift/transport/TTransport.h:23,
>                  from ./src/thrift/transport/TFileTransport.h:23,
>                  from src/thrift/transport/TFileTransport.cpp:22:
> ./src/thrift/concurrency/FunctionRunner.h: In member function 'virtual void 
> apache::thrift::concurrency::FunctionRunner::run()':
> ./src/thrift/transport/PlatformSocket.h:118:29: error: 'usleep' was not 
> declared in this scope
>  #  define THRIFT_SLEEP_USEC usleep
>                              ^
> ./src/thrift/concurrency/FunctionRunner.h:104:9: note: in expansion of macro 
> 'THRIFT_SLEEP_USEC'
>          THRIFT_SLEEP_USEC(intervalMs_ * 1000);
>          ^~~~~~~~~~~~~~~~~
> ./src/thrift/transport/PlatformSocket.h:118:29: note: suggested alternative: 
> 'fseek'
>  #  define THRIFT_SLEEP_USEC usleep
>                              ^
> ./src/thrift/concurrency/FunctionRunner.h:104:9: note: in expansion of macro 
> 'THRIFT_SLEEP_USEC'
>          THRIFT_SLEEP_USEC(intervalMs_ * 1000);
>          ^~~~~~~~~~~~~~~~~ {code}
> A cleaner solution would be better to simply include `<unistd.h>` in 
> `PlatformSocket.h` but it's possible that might slow down compilation.
> The solution is just to include `<unistd.h>` before evaluating 
> `THRIFT_SLEEP_USEC(intervalMs_ * 1000);`



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to