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?



Based on man pages, you need to defined _XOPEN_SOURCE.

Here is example:

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

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

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