This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]