Mail Archives: djgpp/2005/01/26/06:17:26
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 -