Hi,
I had already added the 3 header files as suggested by murphy as follows :-
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <limits.h>
#include "ifile.h"
#include <libgen.h>
#include <stdlib.h>
#include <pwd.h>
The earlier code had cuserid() as follows :-
1) DISCARD strcpy(user , (char*) cuserid((char*)0));
As cuserid() is not a valid function in linux, I can use either getlogin() or getpwuid()
As per Jim's suggestion, if I put the code like this :-
2) DISCARD strcpy(user, getlogin());
I don't have any errors, as follows :-
$ gcc gapw.c
/tmp/cc6K9ODh.o(.text+0x21d): In function `main':
: undefined reference to `getprofilestring'
/tmp/cc6K9ODh.o(.text+0x2ec): In function `main':
: undefined reference to `getprofilestring'
collect2: ld returned 1 exit status
$ make clean
rm -f getkey.o ifile.o bitt.o getkey getapp \
putkey getall getappkeys gapw filetime filetime.o gapw.o bitt \
libExtRelan.so envi envi.o
$ make gapw
cc -c -o gapw.o gapw.c
cc -c -o ifile.o ifile.c
cc -o gapw gapw.o ifile.o -lc_r
/usr/bin/ld: cannot find -lc_r
collect2: ld returned 1 exit status
make: *** [gapw] Error 1
$
But, I think the logic will be changed when we compare the code at 1) and 2), above.
Also, when I do a gcc gapw.c, I still get the above errors, though there are no errors
when I do a make gapw.
Request you to please give your inputs.
Thanks a lot in advance.
Best Regards,
Marconi.