Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make fails with.... #7

Open
mlozier opened this issue May 15, 2020 · 2 comments
Open

make fails with.... #7

mlozier opened this issue May 15, 2020 · 2 comments

Comments

@mlozier
Copy link

mlozier commented May 15, 2020

bcd/bcd.c: In function ‘main’:
bcd/bcd.c:138:2: warning: ignoring return value of ‘setregid’, declared with attribute warn_unused_result [-Wunused-result]
setregid(getgid(), getgid());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc bcd/bcd.o -o bcd/bcd
gcc -g -O2 -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -DNEW_STYLE -Iinclude -Iboggle/boggle -c boggle/boggle/bog.c -o boggle/boggle/bog.o
In file included from boggle/boggle/bog.c:58:0:
boggle/boggle/extern.h:46:7: error: conflicting types for ‘getline’
char *getline(char *);
^~~~~~~
In file included from include/stdio.h:35:0,
from boggle/boggle/bog.c:51:
/usr/include/stdio.h:616:20: note: previous declaration of ‘getline’ was here
extern _IO_ssize_t getline (char **__restrict __lineptr,
^~~~~~~
boggle/boggle/bog.c: In function ‘main’:
boggle/boggle/bog.c:134:2: warning: ignoring return value of ‘setregid’, declared with attribute warn_unused_result [-Wunused-result]
setregid(getgid(), getgid());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
GNUmakefile:158: recipe for target 'boggle/boggle/bog.o' failed
make: *** [boggle/boggle/bog.o] Error 1

Also, is there a way to get make to just compile the tetris application?

Many thanks in advance for a reply.

@hiankun
Copy link

hiankun commented Dec 21, 2020

As the error message said, the getline function has conflicted with the same name in stdio.h file.

I replaced all the getline by my_getline from all the files given by the error message, and successfully compiled the package.

Note that there are several games also have getline, so you have to replace all of them.

@oppiet30
Copy link

gcc -g -O2 -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -DNEW_STYLE -Iinclude -Iboggle/boggle -c boggle/boggle/bog.c -o boggle/boggle/bog.o
In file included from boggle/boggle/bog.c:58:
boggle/boggle/extern.h:46:10: error: conflicting types for ‘getline’; have ‘char *(char *)’
46 | char *getline(char *);
| ^~~~~~~
In file included from include/stdio.h:35,
from boggle/boggle/bog.c:51:
/usr/include/stdio.h:703:18: note: previous declaration of ‘getline’ with type ‘__ssize_t(char ** restrict, size_t * restrict, FILE * restrict)’ {aka ‘long int(char ** restrict, long unsigned int * restrict, FILE * restrict)’}
703 | extern __ssize_t getline (char **__restrict __lineptr,
| ^~~~~~~
make: *** [GNUmakefile:158: boggle/boggle/bog.o] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants