2013年6月7日 星期五

手動設定 VS 2010 的 VC++ IncludePath/LibraryPath/OutputPath

在建立新專案時, 總是要逐一設定專案屬性的輸出目錄 / include目錄 / library目錄, 雖有複製貼上的神技, 但有沒有方法可以變成自行定義的預設初始化路徑...

只要編輯下述兩個檔案, 即可輕輕鬆鬆建立新專案

x86 (win32) : Microsoft.Cpp.Win32.v100.props
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets\v100\Microsoft.Cpp.Win32.v100.props

x64 (win32) : Microsoft.Cpp.x64.v100.props
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets\v100\Microsoft.Cpp.x64.v100.props

開啟編輯上述任一檔案時, 注意下面的文字結構, 黃色標示部份, 為自行定義加入的路徑變數, 存檔再重新開啟visual studio就可以看到, 已自動加入專案屬性的目錄路徑

<PropertyGroup>
<OutDir>$(AppBinPath)\</OutDir>
<IncludePath Condition="'$(IncludePath)' == ''">$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(AppDirPath)\src\common\inc;$(AppDirPath)\src\inc;</IncludePath>
<LibraryPath Condition="'$(LibraryPath)' == ''">$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64;$(AppDirPath)\lib;$(AppDirPath)\src;$(AppDirPath)\src\common\dll;</LibraryPath>
</PropertyGroup>

參考來源 :: http://idaiwan.pixnet.net/blog/post/30789152

沒有留言:

張貼留言