grantpt, unlockpt, ptsname

I’m trying to compile some code that calls grantpt(), unlockpt(), and ptsname(). This code compiles with g++, but with pgCC I keep getting “undefined reference to `grantpt(int)'” errors.

Is there no PGI version of these routines?

Thanks.

Hi,

Based on man pages, you need to defined _XOPEN_SOURCE.

Here is example:

mysys% cat 1115.cpp
#define _XOPEN_SOURCE
#include <stdlib.h>
#include

main () {
int fd = 2;
cout << grantpt(fd) <<endl ;
}

mysys% !pgcpp
pgcpp 1115.cpp
mysys% a.out
-1

Hongyon