is it possible that when I do this:

g++ -c function.cpp

the function.o will be generated in the other directory?

say for example i have FUNC folder

FUNC/function.cpp

I want to generate a function.o that is outside the FUNC folder.

thanx in advance....

Yes. Just use the -o option of gcc.

g++ -c function.cpp -o <PATH_OF_FOLDER>/OBJECTNAME.o

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.