This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Question about placing output to a specific directory
- From: Louie McCrady <louie at otsys dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 10 Apr 2006 10:40:27 -0700
- Subject: Question about placing output to a specific directory
g++ can take a collection of .cpp file names and compile them. I have
not found a way to direct the placement of the resulting .o files to a
specific directory. Is there an option that allows you to specify the
directory where the .o files will be placed?
When I compile a collection of .cpp files at one time, the .o files go
to the current working directory. I would like to have them placed in
an /obj directory somewhere else.
I do not want to compile each .cpp file separately specifying both the
input and output file locations.
I do not want to compile to the current directory, then move the .o
files to a separate /obj directory with a mv command.
I've tried changing the current directory to the ./obj directory, but
this throws off the location to other source, header, and lib files in
other relative directories. This does not appear to be a practical
solution.
I need something like this:
g++ -c foo1.cpp foo2.cpp foo3.cpp -o ./obj/
where foo1.o foo2.o foo3.o get placed in ./obj/ off the current working
directory.
Any help would be greatly appreciated.
Thank you,
Louie.