LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-07-2017, 02:47 PM   #1
sindh
LQ Newbie
 
Registered: Aug 2014
Posts: 28

Rep: Reputation: Disabled
"symlink" is undefined


Hi,

I am trying to create a symbolic link using the function symlink(char*, char*) in C++.
I am including the header file - unistd.h in my c++ file.
The command I used to create sym link - symlink(infilename,outfileName)
The unistd.h file is under the path /usr/include

Whenevr I try to compile the code, I am getting the compilation error - symlink is undefined.
line 878: error(114):identifier "symlink" is undefined
1 error detected in the compilation of "SendBorg.cpp".
c89: /usr/cmplr/ccombe exited, returning 2.


Please help me resolving the above compiler error.
Providing the additional details below.


Details -
Compiler - C89
OS - Tandem OS

Note: I did grep for symlink function in /usr/include. I am able to find the symlink function declaration only in unistd.h and I didn't come across the function definition anywhere.

I am not able to attach the header file. So including the content here.


#ifdef __TANDEM
#pragma columns 80
#if _TANDEM_ARCH_ != 0
#pragma ONCE
#endif
#endif
#ifndef _UNISTD
#define _UNISTD

/* T8645H02 - (13MAY2009) - unistd.h various kernel and FS definitions */
/* T8645G08^AAX - (10MAY2007) */

/*
* Copyright 2009 Hewlett Packard Development Company, L.P.
*
* ALL RIGHTS RESERVED
*/

#if (_TANDEM_ARCH_ == 1 && __G_Series_RVU < 629 || \
_TANDEM_ARCH_ == 2 && __H_Series_RVU < 606) && \
(_FILE_OFFSET_BITS == 64 || _LARGEFILE64_SOURCE == 1)
#error 64-bit functions not available for target RVU
#endif /* 64-bit functions requested when not available */

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __OLDCALLS /* TNS C legacy header */
#pragma nooldcalls
#define REVERT_TO_OLDCALLS
#endif

/*
* COPYRIGHT NOTICE
*
* Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
* ALL RIGHTS RESERVED (OSF/1). See /usr/include/COPYRIGHT.OSF1 .
*/
/* OSF/1 1.3 (Revision 3.0.5.10) */

/*
* (C) COPYRIGHT International Business Machines Corp. 1985, 1989
* All Rights Reserved
* Licensed Materials - Property of IBM
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/

/*
* Copyright (c) 1984 AT&T
* All Rights Reserved
*
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
* The copyright notice above does not evidence any
* actual or intended publication of such source code.
*/

#ifndef _GUARDIAN_HOST
#include <sys/types.h>
#else
#include <systype.h> nolist
#endif /* _GUARDIAN_HOST */

#ifndef NULL
#if defined(_GUARDIAN_TARGET) && defined(__XMEM)
#define NULL 0L
#else
#define NULL 0
#endif
#endif /* NULL */

/*
* Defines for access()
*/
#define R_OK 4 /* Test for read access */
#define W_OK 2 /* Test for write access */
#define X_OK 1 /* Test for execute access */
#define F_OK 0 /* Test for existence of the file */

/*
* Defines for lseek()
*/
#ifndef SEEK_SET
#define SEEK_SET 0 /* Set file pointer to "offset" */
#endif

#ifndef SEEK_CUR
#define SEEK_CUR 1 /* Set file pointer to current + "offset" */
#endif

#ifndef SEEK_END
#define SEEK_END 2 /* Set file pointer to EOF + "offset" */
#endif

/*
* File descriptors for stdin, stdout, and stderr
*/
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2

/*
* Compile-time symbolic constants -- can be interrogated by sysconf()
*/
#define _POSIX_JOB_CONTROL 1 /* Implementation supports job control */
#define _POSIX_SAVED_IDS 1 /* Each process has a saved set-user-ID */
/* and saved set-group-ID */
#define _POSIX_VERSION 199009L /* POSIX Standard version */

#if defined(_XOPEN_SOURCE) || _POSIX_C_SOURCE == 2
/* All of the following are POSIX.2 additions to POSIX.1 */

#define _POSIX2_C_BIND 1 /* Supports the C language bindings */
#define _POSIX2_C_DEV 1 /* Supports the C development utilities */
#undef _POSIX2_FORT_DEV /* No support for fortran dev utilities */
#undef _POSIX2_FORT_RUN /* No support for fortran runtime utilities */
#undef _POSIX2_LOCALEDEF /* No support for the creation of locales */
#define _POSIX2_SW_DEV 1 /* Supports software development utilities */
#undef _POSIX2_CHAR_TERM /* Supports at least one terminal type */
#undef _POSIX2_UPE /* Supports the User Portability Utilities */
#define _POSIX2_C_VERSION 199209L /* Supports ISO POSIX-2 DIS Version 1 */
#define _POSIX2_VERSION 199209L /* POSIX.2 Standard */

#endif /* _XOPEN_SOURCE || _POSIX_C_SOURCE == 2 */

#ifdef _XOPEN_SOURCE
#undef _XOPEN_XCU_VERSION
/* Turn the line above off and the following line on when XPG4 fully supported
#define _XOPEN_XCU_VERSION 4
*/
#define _XOPEN_ENH_I18N 1 /* Supports enhanced I18N */
#define _XOPEN_SHM 1 /* Supports shared memory */
#endif /* _XOPEN_SOURCE */

/*
* Execution-time symbolic constants
* (can be interrogated using pathconf() and fpathconf())
*/
/*
* chown() function is restricted
*/
#define _POSIX_CHOWN_RESTRICTED 1 /* Applies to all files */
/*
* Path components greater than NAME_MAX are never truncated
*/
#define _POSIX_NO_TRUNC 1
/*
* Value to use for disabling special character functions
*/
#define _POSIX_VDISABLE 0xFF
/*
* Defines for sysconf() options
*/
#define _SC_ARG_MAX 1
#define _SC_CHILD_MAX 2
#define _SC_CLK_TCK 3
#define _SC_JOB_CONTROL 4
#define _SC_NGROUPS_MAX 5
#define _SC_OPEN_MAX 6
#define _SC_SAVED_IDS 7
#define _SC_STREAM_MAX 8
#define _SC_TZNAME_MAX 9
#define _SC_VERSION 10

#if defined(_XOPEN_SOURCE) || _POSIX_C_SOURCE == 2
#define _SC_BC_BASE_MAX 15
#define _SC_BC_DIM_MAX 16
#define _SC_BC_SCALE_MAX 17
#define _SC_BC_STRING_MAX 18
#define _SC_COLL_WEIGHTS_MAX 20
#define _SC_EXPR_NEST_MAX 21
#define _SC_LINE_MAX 22
#define _SC_2_C_DEV 23
#define _SC_2_FORT_DEV 24
#define _SC_2_FORT_RUN 25
#define _SC_2_LOCALEDEF 26
#define _SC_2_SW_DEV 27
#define _SC_2_VERSION 28
#define _SC_RE_DUP_MAX 29
#define _SC_2_C_BIND 30
#define _SC_2_UPE 31
#define _SC_XOPEN_VERSION 32
#define _SC_XOPEN_CRYPT 33
#define _SC_XOPEN_ENH_I18N 34
#define _SC_XOPEN_SHM 35
#define _SC_2_CHAR_TERM 36
#define _SC_PASS_MAX 37
#define _SC_XOPEN_XCU_VERSION 38
#define _SC_2_C_VERSION 39
#endif /* _XOPEN_SOURCE || _POSIX_C_SOURCE == 2 */
#if _XOPEN_SOURCE_EXTENDED == 1
#define _SC_IOV_MAX 42
#endif

/*
* Defines for pathconf() options
*/
#define _PC_CHOWN_RESTRICTED 1
#define _PC_LINK_MAX 2
#define _PC_MAX_CANON 3
#define _PC_MAX_INPUT 4
#define _PC_NAME_MAX 5
#define _PC_NO_TRUNC 6
#define _PC_PATH_MAX 7
#define _PC_PIPE_BUF 8
#define _PC_VDISABLE 9

/* Arguments for the confstr() function */
#define _CS_PATH 1

#if _TANDEM_ARCH_ != 0 || !defined(_GUARDIAN_TARGET)

int close (int);
off_t lseek (int, off_t, int);
#if _LARGEFILE64_SOURCE == 1 && _TANDEM_ARCH_ != 0
off64_t lseek64 (int, off64_t, int);
#endif
ssize_t read (int, void *,size_t);
int unlink(const char *);
ssize_t write (int, const void *, size_t);

#if _FILE_OFFSET_BITS == 64 && _TANDEM_ARCH_ != 0 && \
!defined(SPT_THREAD_AWARE_PRAGMA_XNONBLOCK)
#pragma function lseek (alias("lseek64"), unspecified)
#endif

#if defined(_TANDEM_SOURCE) && _TANDEM_ARCH_ == 0 && defined(__INT32)
int unlink_guardian(const char *);
int unlink_oss (const char *);
#endif

#if defined(__TANDEM) && _TANDEM_ARCH_ == 0
#pragma function close (alias("PXFS_FILE_CLOSE_") , tal)
#pragma function lseek (alias("PXFS_FILE_LSEEK_") , tal)
#pragma function read (alias("PXFS_FILE_READ_") , tal)
#pragma function unlink (alias("PXFS_FILE_UNLINK_") , tal)
#pragma function write (alias("PXFS_FILE_WRITE_") , tal)
#if defined(_TANDEM_SOURCE) && defined(__INT32)
#pragma function unlink_guardian (alias("C_REMOVE_32_") , tal)
#pragma function unlink_oss (alias("PXFS_FILE_UNLINK_") , tal)
#endif /* _TANDEM_SOURCE && __INT32 */
#endif /* __TANDEM && _TANDEM_ARCH_ == 0 */

#endif /* _TANDEM_ARCH_ != 0 || !_GUARDIAN_TARGET */

void _exit (int);
int access(const char *, int);
unsigned int alarm (unsigned int);
int chdir (const char *);
int chown (const char *, uid_t, gid_t);
char * ctermid (char *);
/* -- cuserid() defined in stdio.h -- */
int dup (int);
int dup2 (int, int);
int execl (const char *, const char *, ...);
int execle(const char *, const char *, ...);
int execlp(const char *, const char *, ...);
int execv (const char *, char * const [] );
int execve(const char *, char * const [], char *const[]);
int execvp(const char *, char * const [] );
#if _TANDEM_ARCH_ == 1 && __G_Series_RVU >= 628 || \
_TANDEM_ARCH_ == 2 && __H_Series_RVU >= 605
int fchown (int, uid_t, gid_t);
#endif
pid_t fork (void);
long fpathconf (int, int);
char * getcwd (char *, size_t);
gid_t getegid (void);
uid_t geteuid (void);
gid_t getgid (void);
int getgroups (int, gid_t[]);
char * getlogin (void);
pid_t getpgid(pid_t);
pid_t getpgrp (void);
pid_t getpid (void);
pid_t getppid (void);
#if _TANDEM_ARCH_ == 1 && __G_Series_RVU >= 629 || \
_TANDEM_ARCH_ == 2 && __H_Series_RVU >= 607
pid_t getsid (pid_t);
#endif
uid_t getuid (void);
#if _TANDEM_ARCH_ == 2 && __H_Series_RVU >= 618
int initgroups (const char *, gid_t);
#endif
int isatty (int);
#if _TANDEM_ARCH_ == 1 && __G_Series_RVU >= 628 || \
_TANDEM_ARCH_ == 2 && __H_Series_RVU >= 605
int lchown (const char *, uid_t, gid_t);
#endif
int link (const char *,const char *);
long pathconf (const char *, int);
int pause (void);
int pipe (int [2]);
int rmdir (const char *);
#if _TANDEM_ARCH_ == 2 && __H_Series_RVU >= 618
int setegid (gid_t);
int seteuid (uid_t);
int setgroups (int, const gid_t *);
#endif
int setgid (gid_t);
int setpgid (pid_t, pid_t);
#if _TANDEM_ARCH_ == 1 && __G_Series_RVU >= 629 || \
_TANDEM_ARCH_ == 2 && __H_Series_RVU >= 607
pid_t setpgrp (void);
#endif
#if _TANDEM_ARCH_ == 1 && __G_Series_RVU >= 627 || \
_TANDEM_ARCH_ == 2 && __H_Series_RVU >= 605
int setregid (gid_t, gid_t);
int setreuid (uid_t, uid_t);
#endif /* __G_Series_RVU >= 627 || __H_Series_RVU >= 605 */
pid_t setsid (void);
int setuid (uid_t);
unsigned int sleep (unsigned int);
long sysconf (int);
pid_t tcgetpgrp (int);
int tcsetpgrp (int, pid_t);
char * ttyname (int);

#if defined(_XOPEN_SOURCE) || _POSIX_C_SOURCE == 2
size_t confstr(int, char *, size_t);
int getopt (int, char * const [], const char *);
#ifndef _LIBSPACE
/* getopt() declarations */
extern char *optarg;
extern int optind;
extern int optopt;
extern int opterr;
#if defined(__TANDEM) && _TANDEM_ARCH_ != 0
#pragma extern_data no_gp optarg optind optopt opterr
#endif
#endif /* !_LIBSPACE */

#if _TANDEM_ARCH_ != 0 || !defined(__TANDEM)
char *crypt (const char *, const char *);
void encrypt(char [64], int);
int nice (int);
void setkey (const char *);
#endif

#endif /* _XOPEN_SOURCE || _POSIX_C_SOURCE == 2 */

#ifdef _XOPEN_SOURCE
int chroot (const char *);
int fsync (int);
#if _TANDEM_ARCH_ != 0 || !defined(__TANDEM)
char *getpass(const char *);
#endif
void swab (const void *, void *, ssize_t);
#endif /* _XOPEN_SOURCE */

#if _XOPEN_SOURCE_EXTENDED == 1
#if _TANDEM_ARCH_ != 0
int ftruncate(int, off_t);
#if _LARGEFILE64_SOURCE == 1
int ftruncate64(int, off64_t);
#endif
int getdtablesize(void);
int getpagesize(void);
char *getwd(char *);
#endif /* _TANDEM_ARCH_ != 0 */
int readlink(const char *, char *, size_t);
int symlink (const char *, const char *);

#if _FILE_OFFSET_BITS == 64 && _TANDEM_ARCH_ != 0 && \
!defined(SPT_THREAD_AWARE_PRAGMA_XNONBLOCK)
#pragma function ftruncate (alias("ftruncate64"), unspecified)
#endif
#endif /* _XOPEN_SOURCE_EXTENDED == 1 */

#ifdef __TANDEM
#pragma function access (unspecified)
#pragma function isatty (unspecified)
#pragma function fork (unspecified)
#pragma function _exit (unspecified)
#if _TANDEM_ARCH_ != 0
#pragma function getpid (unspecified)
#endif /* _TANDEM_ARCH_ != 0 */
#if _TANDEM_ARCH_ == 0
#pragma function alarm (unspecified)
#pragma function getpgrp (unspecified)
#pragma function getppid (unspecified)
#pragma function setpgid (unspecified)
#pragma function setsid (unspecified)
#endif /* _TANDEM_ARCH_ == 0 */
#endif /* __TANDEM */


#ifdef REVERT_TO_OLDCALLS
#undef REVERT_TO_OLDCALLS
#pragma oldcalls
#endif

#ifdef __cplusplus
}
#endif

#endif /* _UNISTD defined */

 
Old 07-08-2017, 07:01 AM   #2
rigor
Member
 
Registered: Sep 2011
Location: 19th moon ................. ................Planet Covid ................Another.Galaxy;............. ................Not Yours
Posts: 312

Rep: Reputation: Disabled
Hi sindh,

AFAIK, by using the c89 compiler you're effectively asking for a level of compliance to a POSIX specification. Yet I think at one point in time, the symlink function was outside that specification.

If I'm correct in that, then in order to be compliant with the specification, you are not allowed to use the symlink function.

If in your situation it is OK to use functions outside the specification, then it looks as though you can define _XOPEN_SOURCE_EXTENDED to have the value 1 if you wish to use the symlink function.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
"service snmptrapd start" is failing with error "libnetsnmptrapd.so.31: undefined symbol: my_progname" ziaur25 Linux - Software 10 10-24-2018 10:29 PM
"Multiple definition of" and "undefined reference to" in QT Creator with QJson lib echelon89 Programming 1 05-01-2009 06:48 AM
avgscan "relocation error" "undefined symbol: __dynamic_cast_2" Monster_user Linux - Software 0 02-22-2006 11:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:20 AM.

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