delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/01/26/06:17:26

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Wed, 26 Jan 2005 12:20:34 -0200
From: Jonatan Liljedahl <lijon AT kymatica DOT com>
To: djgpp AT delorie DOT com
Subject: Re: Compile problem
Message-Id: <20050126122034.01459342.lijon@kymatica.com>
In-Reply-To: <wrIJd.42$Bc7.36@newsfe3-win.ntli.net>
References: <wrIJd.42$Bc7 DOT 36 AT newsfe3-win DOT ntli DOT net>
Organization: Kymatica
X-Mailer: Sylpheed version 0.9.10 (GTK+ 1.2.10; i686-pc-linux-gnu)
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 26 Jan 2005 08:22:52 GMT
"Mike C" <My DOT address AT end DOT of DOT post> wrote:

> I have a small compile issue:  Running in a DOS window under W2000, if
> I
>  compile using RHIDE, the resulting program runs fine on my PC, but,
>  it seems, not on anybody else's.  If I compile using
> 
>  gcc -Wall -O2 -o myprog.exe myprog.c
> 
>  then the program runs fine on other people's PC's.

strange.

>  My program was originally all in one file, but it getting a bit
>  unwieldy, so have split it into three files and made a project. The
>  problem is that my"compile" line doesn't work any more - the linker
>  can't find the extern references.

I think it should be possible to just do:

	gcc -o myprog.exe *.c

The usual way is to first compile all the separate .c files like this:

	gcc -c file1.c
	gcc -c file2.c
	gcc -c file3.c

then link the resulting objectfiles together like this:

	gcc -o myprog.exe file1.o file2.o file3.o

becouse this means you don't need to recompile all files each time, only
the files you've changed. (create a Makefile and use make)

/Jonatan    -=( http://kymatica.com )=-

- Raw text -


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