delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/25/01:25:08

From: "Tony Kwan" <kwantk AT idirect DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <diDC4.218160$B6 DOT 1555612 AT quark DOT idirect DOT com> <38DB1182 DOT F8A2280A AT mtu-net DOT ru>
Subject: Re: library headaches
Lines: 75
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <sVXC4.218801$B6.1572197@quark.idirect.com>
Date: Sat, 25 Mar 2000 05:12:56 GMT
NNTP-Posting-Host: 216.154.52.112
X-Complaints-To: abuse AT idirect DOT com
X-Trace: quark.idirect.com 953961176 216.154.52.112 (Sat, 25 Mar 2000 00:12:56 EST)
NNTP-Posting-Date: Sat, 25 Mar 2000 00:12:56 EST
Organization: Internet Direct - http://www.mydirect.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

It appears it is a linker problem with RHIDE.  Anyone know a way around it
in RHIDE?

Tony.

"Alexei A. Frounze" <alex DOT fru AT mtu-net DOT ru> wrote in message
news:38DB1182 DOT F8A2280A AT mtu-net DOT ru...
> rand() is a standard C library function. So you should avoid its
> redefinition. Better call it something like rand2().
>
> Good Luck
>
> Tony Kwan wrote:
> >
> > I am trying to make my first multi-file project with RHIDE but the
compiler
> > is giving me errors which I don't know how to fix.  Essentially I am
> > following a tutorial I got from the net on "C Libraries and Makefiles"
from
> > DevCentral:  (abbreviated)
> >
> > /* util.c */
> > #include "util.h"
> > int rand_seed=10;
> >
> > int rand()  {...}
> > void bubble_sort(int m, int a[]) {...}
> >
> > /* util.h */
> > extern int rand();
> > extern void bubble_sort(int, int[]);
> >
> > /* main.c */
> > #include <stdio.h>
> > #include "util.h"
> > #define MAX 10
> > int a[MAX];
> >
> > void main()
> > {
> >    int i;
> >    for (i=0; i<MAX; i++)
> >        a[i]=rand();
> >    bubble_sort(MAX, a);
> > }
> >
> > Error Message:
> > ----------------------------------
> >  Error: util.o: In function `rand':
> >  util.c(6) Error: multiple definition of `rand'
> >  o:util.c(6) Error: first defined here
> >  Error: util.o: In function `bubble_sort':
> >  util.c(12) Error: multiple definition of `bubble_sort'
> >  o:util.c(12) Error: first defined here
> >  Error: util.o(.data+0x0):util.c: multiple definition of `rand_seed'
> >  Error: util.o(.data+0x0):util.c: first defined here
> >  There were some errors
> >
> > I just freshly installed DJGPP with RHIDE 1.47 so all the settings are
at
> > default.  This error is consistent with a larger project that I am
working
> > on.  I've already checked the FAQs and many sites on the web to no
avail.
> > Any help or working project examples would be greatly appreciated.
> >
> > Thanks,
> > Tony.
>
> --
> Alexei A. Frounze
>
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019