# ptsname_r undefined reference



## reslab (May 12, 2019)

Hello, i'm compile MakoServer, error ptsname_r undefined reference
FreeBSD stdlib.h  ptsname(), but no function ptsname_r()
What shall I do?







UPD: replaced ptsname_ function r with ptsname no error compile,  






but no further work


----------



## mark_j (May 28, 2019)

I had a quick look in the offending code:

```
#if defined(BSD) || defined(_OSX_)
#define XTABS OXTABS
static int
ptsname_r(int fd, char* b, int bl)
{
   char* z398210871831554303228849511=ptsname(fd);
   if(z398210871831554303228849511 && strlen(z398210871831554303228849511) < bl)
   {
      strcpy(b,z398210871831554303228849511);
      return 0;
   }
   return -1;
}
#endif
```

So define BSD (-DBSD) on the command line. 

FYI:
You can grep the pre-processor defines for gcc like so:
*gcc -dM -E - < /dev/null*

Or clang:
*clang -dM -E - < /dev/null*

There's even a URL for some (not sure how up to date?):





						Pre-defined Compiler Macros / Wiki / OperatingSystems
					






					sourceforge.net
				




PS. I would have thought BSD was defined, it was years ago.


----------

