我是Visual Studio的新手,不确定如何链接文件。
我正在尝试创建一个使用ksproperties测试相机属性范围的应用程序。例如:要找出设备支持的曝光,缩放和白平衡范围。
因此,我需要调用Microsoft API,例如 KSPROPERTY_CAMERA_CONTROL_S和KSPROPERTY_CAMERACONTROL_EXPOSURE。
这是我的包含物:
#include <ks.h>
#include <ksmedia.h>
#include <ksproxy.h>
我也像这样尝试过它们:
#include "ks.h"
#include "ksmedia.h"
#include "ksproxy.h"
但是我仍然遇到依赖错误(4/82错误):
Severity Code Description
Error (active) E0020 identifier "PKSPROPERTY" is undefined
Error (active) E0020 identifier "KSPROPERTY_CAMERACONTROL_S" is undefined
Error (active) E0020 identifier "PKSMETHOD" is undefined
Error (active) E0020 identifier "PKSEVENT" is undefined
这些标识符位于文件ks.h,ksmedia.h和ksproxy.h中,并且这些文件位于以下目录中:C:\ Program Files(x86)\ Windows Kits \ 10 \ Include \ 10.0.17134.0 \ shared
在我尝试过的其他事情中,我观看了以下视频以尝试解决问题: https://www.youtube.com/watch?v=HExn9oTqdVo 它指示转到项目的项目文件夹-> C / C ++选项卡->常规,并将以上目录路径添加到其他包含目录。以及“链接器”选项卡(在项目属性的文件夹内)->“常规”,并将以上目录路径添加到“其他库目录”中。
但是相同的错误仍然存在。我正在使用Visual Studio2017。并使用C ++进行编码。
更新
尝试添加#pragma message(message string)的@RbMn建议,我得到以下输出窗口。 (注意:,我注释掉了使用ks.h,ksmedia.h和ksproxy.h文件中的结构/变量的所有代码,以使其输出较小)。在ksmedia.h中,我在文件的开头添加了#pragma message("Testing at beginning of ksmedia.h")
,并在KSPROPERTY_CAMERACONTROL_S结构的后面添加了#pragma message("After KSPROPERTY_CAMERACONTROL_S struct")
。
输出显示未达到第二个编译指示消息:
1>------ Build started: Project: CameraStarterKit, Configuration: Release ARM ------
1>exposure.cpp
1>Testing at beginning of ksmedia.h
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1205,5): warning MSB8012: TargetPath(C:\Window_Sample_Apps\Samples\CameraStarterKit\cpp\ARM\Release\CameraStarterKit\CameraStarterKit) does not match the .exe's OutputFile property value (Linker). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(C:\Window_Sample_Apps\Samples\CameraStarterKit\cpp\ARM\Release\CameraStarterKit\CameraStarterKit.OutputFile).
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1205,5): warning MSB8012: TargetPath(C:\Window_Sample_Apps\Samples\CameraStarterKit\cpp\ARM\Release\CameraStarterKit\CameraStarterKit) does not match the .exe's OutputFile property value (Linker). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(C:\Window_Sample_Apps\Samples\CameraStarterKit\cpp\.exe.OutputFile).
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1207,5): warning MSB8012: TargetName(CameraStarterKit) does not match the 's OutputFile property value (Linker). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(CameraStarterKit.OutputFile).
1>CameraStarterKit.vcxproj -> C:\Window_Sample_Apps\Samples\CameraStarterKit\cpp\ARM\Release\CameraStarterKit\CameraStarterKit;.exe
1>Done building project "CameraStarterKit.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========