Compilation Error--Undeclared Identifier


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Compilation Error--Undeclared Identifier
# 1  
Old 05-26-2012
Compilation Error--Undeclared Identifier

Hello, I am trying to install BBFTP software on my Mac (OS X), and am running into some compilation errors. Here is the code, the specific errors are listed after:
Code:
#include <dirent.h>
#include <errno.h>
#include <fnmatch.h>
#include <netinet/in.h>
#include <syslog.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <utime.h>

#include <bbftpd.h>
#include <common.h>
#include <daemon.h>
#include <daemon_proto.h>
#include <status.h>
#include <structures.h>

extern int  transferoption ;
extern int  outcontrolsock ;
extern	int	recvcontrolto ;
extern	int	sendcontrolto ;

int bbftpd_list(char *pattern,char *logmessage) 
{

    char    *filelist ;
    int     filelistlen ;
    int     retcode ;
    char    send_buffer[MINMESSLEN] ;
    struct message *msg ;
    
    
    if ( (retcode = bbftpd_retrlistdir(pattern,&filelist,&filelistlen,logmessage) ) < 0) {
        reply(MSG_BAD_NO_RETRY,logmessage) ;
        return 0 ;
    } else if ( retcode > 0 ) {
        reply(MSG_BAD,logmessage) ;
        return 0 ;
    } else {
        msg = (struct message *) send_buffer ;
        msg->code = MSG_LIST_REPL_V2 ;
#ifndef WORDS_BIGENDIAN
        msg->msglen = ntohl(filelistlen) ;
#else 
        msg->msglen = filelistlen ;
#endif
        if ( writemessage(outcontrolsock,send_buffer,MINMESSLEN,recvcontrolto) < 0 ) {
            syslog(BBFTPD_ERR,"Error sending LISTREPL_V2 part 1") ;
            FREE(filelist) ;
            return -1 ;
        }
        if (filelistlen != 0 ) {
            if ( writemessage(outcontrolsock,filelist,filelistlen,recvcontrolto) < 0 ) {
                FREE(filelist) ;
                syslog(BBFTPD_ERR,"Error sending filelist") ;
                return -1 ;
            }
            FREE(filelist) ;
            return 0 ;
        }
        return 0 ;
    }
}

Here are the errors I received (the affected lines are in bold):
bbftpd_list.c:84:13: error: use of undeclared identifier 'NULL'
            FREE(filelist) ;
            ^
../includes/common.h:95:25: note: expanded from macro 'FREE'
#define FREE(X) if(X != NULL) { free(X), X=NULL;}
                        ^
bbftpd_list.c:84:13: warning: implicit declaration of function 'free' is invalid
      in C99 [-Wimplicit-function-declaration]
            FREE(filelist) ;
            ^
../includes/common.h:95:33: note: expanded from macro 'FREE'
#define FREE(X) if(X != NULL) { free(X), X=NULL;}
                                ^
bbftpd_list.c:84:13: error: use of undeclared identifier 'NULL'
            FREE(filelist) ;
            ^
../includes/common.h:95:44: note: expanded from macro 'FREE'
#define FREE(X) if(X != NULL) { free(X), X=NULL;}
                                           ^
bbftpd_list.c:89:17: error: use of undeclared identifier 'NULL'
                FREE(filelist) ;
                ^
../includes/common.h:95:25: note: expanded from macro 'FREE'
#define FREE(X) if(X != NULL) { free(X), X=NULL;}
                        ^
bbftpd_list.c:89:17: error: use of undeclared identifier 'NULL'
                FREE(filelist) ;
                ^
../includes/common.h:95:44: note: expanded from macro 'FREE'
#define FREE(X) if(X != NULL) { free(X), X=NULL;}
                                           ^
bbftpd_list.c:93:13: error: use of undeclared identifier 'NULL'
            FREE(filelist) ;
            ^
../includes/common.h:95:25: note: expanded from macro 'FREE'
#define FREE(X) if(X != NULL) { free(X), X=NULL;}
                        ^
bbftpd_list.c:93:13: error: use of undeclared identifier 'NULL'
            FREE(filelist) ;

Does anyone know how to fix this problem? Help is greatly appreciated.
Blessings,
Tyler

Last edited by Scott; 05-26-2012 at 02:18 PM.. Reason: Please use code tags.
# 2  
Old 05-26-2012
#include <stdio.h> to get NULL.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Is not a identifier error

Hi I am trying to execute a script. I have solaris 10, After i login i will toggle to BASH. The script tried to set a variable called CARBON_HOME. Even i tried to set it manually. But still it is saying the following error.:wall: " CARBON_HOME=/usr/wso2/wso2esb-4.0.0: is not an... (5 Replies)
Discussion started by: gnanagurus
5 Replies

2. Shell Programming and Scripting

error while extracting a line from a file based on identifier

here is the content of input file CREATE TABLE `bla bla bla` ( `allianceSiteId` int(11) DEFAULT NULL, `trunkGroupsId` int(11) DEFAULT NULL, `lastModified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, UNIQUE KEY `allianceSiteId`... (4 Replies)
Discussion started by: vivek d r
4 Replies

3. Programming

error:'MSG_R' undeclared (first use in this function) under Solaris

I read book Unix Network Programming written by Richard,and it define following code under unpipc.c #define SVMSG_MODE (MSG_R | MSG_W | MSG_R>>3 | MSG_R>>6) when I compile code,it raise following error: error:'MSG_R' undeclared (first use in this function) error:'MSG_W' undeclared (first use... (1 Reply)
Discussion started by: konvalo
1 Replies

4. Shell Programming and Scripting

is not an identifier error

Hi gurus, I am trying to execute a shell script which connects to the oracle db and get the values from a table and then it exports the values on UNIX. For this, I am creating a temp file which stores the values returned from the select query and then executes this file. Below is the code which... (13 Replies)
Discussion started by: svajhala
13 Replies

5. Programming

'SIGHUP','SIGTSTP' undeclared

I compile following statement signal(SIGHUP,sig_hup); kill(getpid(),SIGTSTP); $gcc test.c it raise following error: error:'SIGHUP' undeclared (first use in this function) error:'SIGTSTP' undeclared (first use in this function) Why raise above error? which head file include... (1 Reply)
Discussion started by: konvalo
1 Replies

6. AIX

Installation error - '_UKJBLEN' undeclared here

Hi, I want to install a ghostscript file in AIX 5.3.. i confgiured it then gave make command. it has thrown the following error. -O2 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -Wno-strict-aliasing -fno-builtin -fno-common -DHAVE_STDINT_H... (0 Replies)
Discussion started by: meeraramanathan
0 Replies

7. Shell Programming and Scripting

Getting is not an identifier error

Hi all, I am getting this error while setting CLASSPTH using a script my script is #!bin/ksh export CLASSPATH=$CLASSPATH:<some path>:<some path> If i do this thing on shell prompt individually it is working fine. but while using in shell script it is giving error. better if you... (12 Replies)
Discussion started by: swat
12 Replies

8. Programming

Compilation error

I am compiling a software xchm on solaris 10. First i run './configure' There is no error. But when i start compiling using 'gmake' following error shown /usr/local/include/wx-2.6/wx/x11/brush.h: In copy constructor `wxBrush::wxBrush(const wxBrush&)':... (3 Replies)
Discussion started by: mansoorulhaq
3 Replies

9. Programming

compilation error

Hi, While trying compile a C++ file in UNIX with gcc whose make rule involves the usage of /usr/ccs/bin/as, I get the following error: /usr/ccs/bin/as: No such file or directory /usr/ccs/bin/as: error: write error on output file "<filename>.o" *** Error code 1 clearmake: Error: Build... (2 Replies)
Discussion started by: smanu
2 Replies

10. Programming

Regarding compilation error.

Hi All, I facing the following compilation error; when I implementing the following logic. ostrstream ostr; ostr << (( scAxsm.getRecord( i ).getField( 2 ).getShort())%12)!=0?(( scAxsm.getRecord( i ).getField( 2 ).getShort())/12+1) : (( scAxsm.getRecord( i ).getField( 2 ).getShort())/12) <<... (1 Reply)
Discussion started by: sweta
1 Replies
Login or Register to Ask a Question