Sign in to follow this  

[Visual C++] *.obj creation folder

This topic is 666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Visual C++ creates all *.obj files in Debug or Release folders. Is there a way to make it create those files next to their corresponding *.cpp files? Because at the moment when I have two files with the same names but in different folders in my directory hierarchy I get conflicts.

Share this post


Link to post
Share on other sites

What I do to get around this is have VC++ makes all of the sub directories in the object folders.

 

In the Project Property Pages -> C/C++ -> Output Files

Object File Name = $(IntDir)%(RelativeDir)\

Edited by Rattrap

Share this post


Link to post
Share on other sites

Good hint with the %(RelativeDir). Although your solution creates all the files in wrong directory for me.

My folders structure is this:

build -> vc2013 -> here lie project and solution files as well as Debug and Release folders
src -> here are all sources

So when I use your solution my relative src files have paths:

../../src/file.cpp

And as such my src objs are generated next to vc2013 folder, that is, two folders up from the $(IntDir) (which is correct because %(RelativeDir) has two "..").

 

To solve this problem and have my objs in nice tree structure (just like src files are) but *inside* $(IntDir) (that is, either Debug or Release) I did this:

$(IntDir)\dummy\dummy\%(RelativeDir)\

The dummy folders don't exist and they don't have to because the part ..\..\ that is part of %(RelativeDir) will cancel them.

Share this post


Link to post
Share on other sites

This topic is 666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this