Mailinglist Archive: opensuse (1125 mails)

< Previous Next >
Re: [opensuse] gnu libc manual wrong?? concat (const char *str, ...) doesn't work...
El 11/05/12 15:06, David C. Rankin escribió:


The compiler issues 2 warning (obviously the problem) that I cannot fix?

13:55 alchemy:~/dev/prg/ccpp/src-c/io/file> gcc -Wall -oct contest.c
contest.c: In function ‘concat’:
contest.c:61:4: warning: implicit declaration of function ‘mempcpy’
contest.c:61:9: warning: incompatible implicit declaration of built-in function
‘mempcpy’


Here is the bug in your code (and actually, a widely spread error, so no need to pull your hair on frustration :))

> #include<stdio.h>
> #include<stdlib.h>
> #include<string.h>
> #include<stdarg.h>
>
> #ifndef _GNU_SOURCE
> #define _GNU_SOURCE
> #endif


This piece

> #ifndef _GNU_SOURCE
> #define _GNU_SOURCE
> #endif

have to go BEFORE

> #include<stdio.h>
> #include<stdlib.h>
> #include<string.h>
> #include<stdarg.h>

CHeers.

ps: gcc 4.7 with -O2 may axe your strcat 's and perform the optimization for you.




--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
References