LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-07-2019, 08:12 AM   #1
MattRW
Member
 
Registered: Feb 2018
Location: Los Angeles area
Distribution: ubuntu, redhat, fedora
Posts: 34

Rep: Reputation: Disabled
ptsname() undefined?


Does anyone know how I can enable the declaration of ptsname() in stdlib.h? Or do I have another issue?

I am on Ubuntu 18.04.

Code:
$ cat zz.c
#define _XOPEN_SOURCE
#include <stdlib.h>

int foo() {
  char *n = ptsname(0);
}

$ gcc -c zz.c
zz.c: In function 'foo':
zz.c:5:13: warning: implicit declaration of function 'ptsname' [-Wimplicit-function-declaration]
   char *n = ptsname(0);
             ^~~~~~~
zz.c:5:13: warning: initialization makes pointer from integer without a cast [-Wint-conversion]

Last edited by MattRW; 03-07-2019 at 08:17 AM.
 
Old 03-07-2019, 08:48 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
probaby:
#define _XOPEN_SOURCE 600
https://stackoverflow.com/questions/...source-do-mean
 
3 members found this post helpful.
Old 03-07-2019, 09:42 AM   #3
MattRW
Member
 
Registered: Feb 2018
Location: Los Angeles area
Distribution: ubuntu, redhat, fedora
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
That worked. Thanks!
 
Old 03-07-2019, 11:45 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
glad to help you.
If you really want to say thanks just click on yes. If your problem solved please mark the thread solved.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Notice: Undefined index / Undefined variable in /var/log/httpd/error_log AdultFoundry Linux - Server 3 06-20-2016 06:06 PM
[SOLVED] ldap_add undefined attribute type (17) additional info attribute type undefined yashfire007 Linux - Newbie 6 03-20-2015 09:12 AM
PHP Problem ('undefined index', 'undefined function') zokken Programming 2 12-04-2008 10:18 AM
why compiler gives undefined references on static members??? Hano Programming 8 06-26-2002 11:12 AM
Need Perl/CGI help! Undefined Subroutine CragStar Programming 4 03-05-2002 07:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration