我正在使用Windows 10上的Visual Studio 2013开发项目。基本上我正在使用C ++编写一些MEX文件,并且我使用了一些我经常使用的库:OpenCV和MATLAB的extern库。对于每个库,我已经保存了包含所有必要信息的属性表(.props文件)。它的要点是我试图将我的opencv.props文件和我的matlab.props文件添加到项目中。
当我尝试将多个属性表添加到“Property Manager”中的属性配置时,出现了当前的问题。对于每一个,我点击“添加现有的属性表”,瞧!我应该得到适当的设置。当我只使用一个属性表时,一切正常。当我尝试添加多张纸时,只有最近的添加似乎正在注册。
知道我哪里出错了?
我已粘贴下面.props文件的内容,因为它们非常简短:
matlab.props
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(MATLAB_DIR)\extern\include</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
opencv.props
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_PropertySheetDisplayName>OpenCV_debug</_PropertySheetDisplayName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(OPENCV_DIR)\..\..\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(OPENCV_DIR)\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>opencv_calib3d$(OPENCV_VERSION)d.lib;opencv_contrib$(OPENCV_VERSION)d.lib;opencv_core$(OPENCV_VERSION)d.lib;opencv_features2d$(OPENCV_VERSION)d.lib;opencv_flann$(OPENCV_VERSION)d.lib;opencv_gpu$(OPENCV_VERSION)d.lib;opencv_highgui$(OPENCV_VERSION)d.lib;opencv_imgproc$(OPENCV_VERSION)d.lib;opencv_legacy$(OPENCV_VERSION)d.lib;opencv_ml$(OPENCV_VERSION)d.lib;opencv_nonfree$(OPENCV_VERSION)d.lib;opencv_objdetect$(OPENCV_VERSION)d.lib;opencv_ocl$(OPENCV_VERSION)d.lib;opencv_photo$(OPENCV_VERSION)d.lib;opencv_stitching$(OPENCV_VERSION)d.lib;opencv_superres$(OPENCV_VERSION)d.lib;opencv_ts$(OPENCV_VERSION)d.lib;opencv_video$(OPENCV_VERSION)d.lib;opencv_videostab$(OPENCV_VERSION)d.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
答案 0 :(得分:2)
通常,属性表中的属性会覆盖以前设置的属性。要保留以前的设置,您必须明确添加它们(使用%(&lt; prop&gt;)宏语法)。
例如,在 opencv.props 文件中,您需要替换
<AdditionalIncludeDirectories>$(MATLAB_DIR)\extern\include</AdditionalIncludeDirectories>
与
<AdditionalIncludeDirectories>$(MATLAB_DIR)\extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
对<AdditionalLibraryDirectories>
属性应用相同的更改; <AdditionalDependencies>
已经是正确的。