[ amavisto @ 08.07.2003. 02:16 ] @
kod:

#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b;
div_t rez;
printf("Unesi deljenik i delioc: ");
scanf("%d",&a);
scanf("%d",&b);
rez=div(a,b);
printf("Kolicnik: %d, ostatak: %",rez.quot, rez.rem);
return 0;
}

kompajler javi gresku:

stdlib.c:10: conflicting types for `div_t'
/usr/include/stdlib.h:98: previous declaration of `div_t'
stdlib.c:13:1: unterminated #ifndef

Nista nisam cackao stdlib.h
U cemu je problem?

[ bokash @ 08.07.2003. 05:20 ] @
KOji kompajler, VC6 radi bez greske.
[ amavisto @ 08.07.2003. 10:23 ] @
Kompajler je gcc (v. 3.2)
[ DownBload @ 08.07.2003. 12:00 ] @
div_t tip je vjerojatno deklariran u stdio.h datoteci, pa ti stdlib.h netreba.
[ amavisto @ 08.07.2003. 12:12 ] @
Citat:
DownBload:
div_t tip je vjerojatno deklariran u stdio.h datoteci, pa ti stdlib.h netreba.


onda se dobije:
: In function `main':
`div_t' undeclared (first use in this function)
(Each undeclared identifier is reported only once
for each function it appears in.)
parse error before "rez"
`rez' undeclared (first use in this function)

izvod iz stdlib.h:

/* Returned by `div'. */
typedef struct
{
int quot; /* Quotient. */
int rem; /* Remainder. */
} div_t;

Znaci nije to.
[ tOwk @ 08.07.2003. 12:29 ] @
Ni gcc 2.95.3 nema problema. O kom se sistemu radi? Čini se kao da se nekako provuče i učitava više puta stdlib.h.
[ amavisto @ 08.07.2003. 14:48 ] @
Citat:
tOwk:

Ni gcc 2.95.3 nema problema. O kom se sistemu radi? Čini se kao da se nekako provuče i učitava više puta stdlib.h.



SuSE 8.1, kernel 2.4.19-4GB, gcc 3.2
Sad radi. Ne znam u cemu je fora. Hvala svima na odgovorima