From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Shawn" To: help-gcc@gnu.org Subject: Re: Directory of object files Date: Mon, 06 Dec 1999 09:41:00 -0000 Message-ID: <384bf412@oit.umass.edu> References: <38389EA5.3A48F3A1@cm-24-142-61-57.cableco-op.ispchannel.com> X-SW-Source: 1999-q4/msg01112.html Message-ID: <19991206094100.DdwNGG0okB0SJdVKZ2V68vqHiVYSCj4aTS8Via7sI_I@z> "Kai Yue" wrote in message news: 38389EA5.3A48F3A1@cm-24-142-61-57.cableco-op.ispchannel.com ... > > Hi, > > When I run "gcc", it would put the object file in the directory where > it is > called rather than the directory where the source file is. I have tried > > gcc versions 2.7.2.3 and egcs-2.91.66 on two different machines and both > have > the same behavior. I am using linux and make version 3.7.6.1 > > I am wondering if there is a way of changing this, i.e., forcing gcc > to > place the object file in the directory of the source file. > > Your help would be greatly appreciated. > > Kai > Kai, Just use the -o command line option for gcc. If your source files are in the ./src directory, and you also wanted to put your object files there use: gcc ./src/myfile.c -Wall -c -o ./src/myfile.o -Shawn