Get the Directory of $(ProjectDir) in VC++
In vcproj
Proper开发者_如何学Goty, there exists a list of build macro properties. Among them are $(OutDir)
, $(ProjectName)
and $(ProjectDir)
.
Question, what is the macro ( or the command to get the directory of $(ProjectDir)
?
This is because I want to write the output dll to the parent directory of $(ProjectDir)
, or a folder inside the parent folder.
simply set Settings->General->Output Directory
( == OutputDirectory element under section in the vcproj file) to $(ProjectDir)..
alternatively if you want just the executable there, not the pdb etc, change the General->OutputFile
to $(ProjectDir)..\$(TargetFileName)
edit: since this doesn't seeem to work for you, but it does for me, maybe you're missing a slash? Can you post the value of your $(ProjectDir)
?
for example, I have these macro values in a dll project:
$(ProjectDir) d:\path\to\project\core\
$(ProjectPath) d:\path\to\project\core\core.vcproj
consequently, setting the OutputDirectory to $(ProjectDir)..\xxx
, my dll goes here: d:\path\to\project\core.dll
精彩评论