Compile error - getpid was not declared in this scope

I'm trying to do a source install of OpenCASCADE653.tar.gz, configure succeeds copy of config.log attached.

I have the following compile error from make make -j8 install

../../../ros/src/OSD/OSD_MemInfo.cxx: In member function 'void OSD_MemInfo::Update()':
../../../ros/src/OSD/OSD_MemInfo.cxx:87:61: error: 'getpid' was not declared in this scope

How can I fix this problem?

Attachments: 
Forum supervisor's picture

Dear Charles,
'getpid' declared in /usr/include/unistd.h
In RHEL the distributive package glibc-headers contains this file.
Could you check that package glibc-headers is installed.
Regards

oldbrad's picture

Hi Thanks for the quick reply.

/usr/include/unistd.h is present from glibc-devel 2.15-57.fc17 and
$ cat /usr/include/unistd.h | grep getpid
extern __pid_t getpid (void) __THROW;

Which I don't understand.

oldbrad's picture

The answer appears to be that neither OSD_MemInfo.cxx or OSD_MemInfo.hxx include unstd.h !

Where should the #include statement go?

Forum supervisor's picture

Dear Charles,
Current implementation of OSD_MedInfo.cxx (development version) contains inclusion of 'unistd.h'.
See below.

#if (defined(_WIN32) || defined(__WIN32__))
#include
#include
#include
#include
#ifdef _MSC_VER
#pragma comment(lib, "Psapi.lib")
#endif
#elif (defined(__APPLE__))
#include
#include
#else
#include
#endif

Regards

AlexanderPletzer's picture

Hi,

I encountered the same error on Fedora 17 using
g++ (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)

Is there any way we can access the development version? Thanks.

Forum supervisor's picture

Dear Alexander,

The development version is available via the Collaborative portal - "http://dev.opencascade.org/index.php?q=home/get_involved".
Regards