1. 程式人生 > >如何在一個系統下同時安裝VS2010和VS2013並使用不同預設外部庫

如何在一個系統下同時安裝VS2010和VS2013並使用不同預設外部庫

我的64位Win7中同時安裝有VS2010(先安裝)和VS2013(後安裝),VS2010中使用opencv2.4.11,在VS2013中使用opencv3.1.0。  若直接在屬性管理器的中進行修改,則會導致兩個版本的VS設定一樣,因為VS2010和VS2013共享“C:\Users\使用者名稱\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props”等檔案,所以應該直接在以上檔案裡進行修改。

將Microsoft.Cpp.Win32.user.props修改為: <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">   <PropertyGroup>     <ExecutablePath Condition="$(PlatformToolsetVersion)=='100'">C:\Program Files\OpenCV24\opencv\build\x86\vc10\bin;$(ExecutablePath)</ExecutablePath>     <ExecutablePath Condition="$(PlatformToolsetVersion)=='120'">C:\Program Files\OpenCV31\opencv\build\install\x64\vc12\bin;$(ExecutablePath)</ExecutablePath>   </PropertyGroup>   <PropertyGroup>     <IncludePath Condition="$(PlatformToolsetVersion)=='100'">C:\Program Files\OpenCV24\opencv\build\include\opencv2;C:\Program Files\OpenCV24\opencv\build\include\opencv;C:\Program Files\OpenCV24\opencv\build\include;$(IncludePath)</IncludePath>     <IncludePath Condition="$(PlatformToolsetVersion)=='120'">C:\Program Files\OpenCV31\opencv\build\install\include\opencv2;C:\Program Files\OpenCV31\opencv\build\install\include\opencv;C:\Program Files\OpenCV31\opencv\build\install\include;$(IncludePath)</IncludePath>   </PropertyGroup>   <PropertyGroup>     <LibraryPath Condition="$(PlatformToolsetVersion)=='100'">C:\Program Files\OpenCV24\opencv\build\x86\vc10\lib;$(LibraryPath)</LibraryPath>     <LibraryPath Condition="$(PlatformToolsetVersion)=='120'">C:\Program Files\OpenCV31\opencv\build\install\x64\vc12\lib;$(LibraryPath)</LibraryPath>     <EmbedManifest>true</EmbedManifest>   </PropertyGroup>   <ItemDefinitionGroup>     <Link>       <AdditionalDependencies Condition="$(PlatformToolsetVersion)=='100'">opencv_calib3d2411d.lib;opencv_contrib2411d.lib;opencv_core2411d.lib;opencv_features2d2411d.lib;opencv_flann2411d.lib;opencv_gpu2411d.lib;opencv_highgui2411d.lib;opencv_imgproc2411d.lib;opencv_legacy2411d.lib;opencv_ml2411d.lib;opencv_nonfree2411d.lib;opencv_objdetect2411d.lib;opencv_ocl2411d.lib;opencv_photo2411d.lib;opencv_stitching2411d.lib;opencv_superres2411d.lib;opencv_ts2411d.lib;opencv_video2411d.lib;opencv_videostab2411d.lib;opencv_calib3d2411.lib;opencv_contrib2411.lib;opencv_core2411.lib;opencv_features2d2411.lib;opencv_flann2411.lib;opencv_gpu2411.lib;opencv_highgui2411.lib;opencv_imgproc2411.lib;opencv_legacy2411.lib;opencv_ml2411.lib;opencv_nonfree2411.lib;opencv_objdetect2411.lib;opencv_ocl2411.lib;opencv_photo2411.lib;opencv_stitching2411.lib;opencv_superres2411.lib;opencv_ts2411.lib;opencv_video2411.lib;opencv_videostab2411.lib;%(AdditionalDependencies)</AdditionalDependencies>       <AdditionalDependencies Condition="$(PlatformToolsetVersion)=='120'">opencv_aruco310.lib;opencv_bgsegm310.lib;opencv_bioinspired310.lib;opencv_calib3d310.lib;opencv_ccalib310.lib;opencv_core310.lib;opencv_cudaarithm310.lib;opencv_cudabgsegm310.lib;opencv_cudacodec310.lib;opencv_cudafeatures2d310.lib;opencv_cudafilters310.lib;opencv_cudaimgproc310.lib;opencv_cudalegacy310.lib;opencv_cudaobjdetect310.lib;opencv_cudaoptflow310.lib;opencv_cudastereo310.lib;opencv_cudawarping310.lib;opencv_cudev310.lib;opencv_datasets310.lib;opencv_dnn310.lib;opencv_dpm310.lib;opencv_face310.lib;opencv_features2d310.lib;opencv_flann310.lib;opencv_fuzzy310.lib;opencv_hdf310.lib;opencv_highgui310.lib;opencv_imgcodecs310.lib;opencv_imgproc310.lib;opencv_line_descriptor310.lib;opencv_ml310.lib;opencv_objdetect310.lib;opencv_optflow310.lib;opencv_photo310.lib;opencv_plot310.lib;opencv_reg310.lib;opencv_rgbd310.lib;opencv_saliency310.lib;opencv_shape310.lib;opencv_stereo310.lib;opencv_stitching310.lib;opencv_structured_light310.lib;opencv_superres310.lib;opencv_surface_matching310.lib;opencv_text310.lib;opencv_tracking310.lib;opencv_ts310.lib;opencv_video310.lib;opencv_videoio310.lib;opencv_videostab310.lib;opencv_xfeatures2d310.lib;opencv_ximgproc310.lib;opencv_xobjdetect310.lib;opencv_xphoto310.lib;%(AdditionalDependencies)</AdditionalDependencies>       <AdditionalLibraryDirectories Condition="$(PlatformToolsetVersion)=='100'">C:\Program Files\OpenCV24\opencv\build\x86\vc10\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>       <AdditionalLibraryDirectories Condition="$(PlatformToolsetVersion)=='120'">C:\Program Files\OpenCV31\opencv\build\install\x64\vc12\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>     </Link>     <ClCompile>       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>     </ClCompile>   </ItemDefinitionGroup> </Project> 其中屬性值Condition="$(PlatformToolsetVersion)=='100'"為重要修改,它代表當前設定為VS2010採用的設定,同理,屬性值Condition="$(PlatformToolsetVersion)=='120'"即代表當前設定為VS2013採用的設定。在相應標籤中加入該屬性值,就能使VS2010和VS2013採用不同的外部庫及屬性設定。 ---------------------  作者:qq_20828113  來源:CSDN  原文:https://blog.csdn.net/qq_20828113/article/details/53241524?utm_source=copy