• 15
• 15
• 11
• 9
• 10

# [Visual C++] *.obj creation folder

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

## 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 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.