hi guys,
i have the following code:
main.c
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <limits.h> //defines PATH_MAX
#define _GNU_SOURCE
#ifndef PATH_MAX
#define PATH_MAX 255
#endif
int main(void)
{
char mycwd[PATH_MAX];
fprintf(stderr, "\nThe PATH_MAX is %d\n", PATH_MAX);
if (getcwd(mycwd, PATH_MAX) == NULL)
{
perror("Failed to get current working directory");
return 1;
}
fprintf(stderr, "Current working directory: %s\n", mycwd);
fprintf(stderr, "the same ::>> %s\n\n\n", get_current_dir_name() );
return 0;
}
this code compiles with gcc main.c
but if i compile like this gcc main.c -std=c99
i get::
warning: implicit declaration of function ‘get_current_dir_name’
so i do a man getcwd
and i see
....Get_current_dir_name, which has a prototype that, if the constant is defined _GNU_SOURCE....
so i do a #define _GNU_SOURCE
but after that i still get the same error....
any ideas how can i incude the prototype of this function??
-nicolas