元数据操作失败LNK2022错误 (8013118D):重复类型中的布局信息不一致 (选择设备参数):(0x020002
Error LNK2022 metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (ChooseDeviceParam): (0x02000273)
我最近有一个.NET项目要编译,而无需以前的开发人员进一步了解,并且在修复了大多数错误之后(我使用的是Visual Studio 2017,项目的先前版本是这样的(
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
我仍然收到错误
行抑制状态错误 LNK2022元数据操作失败 (8013118D(:重复类型中的布局信息不一致 (选择设备参数(:(0x02000273(。
这是声明"ChooseDeviceParam"的代码的一部分(VideoSourceList.cpp(
struct ChooseDeviceParam
{
IMFActivate **ppDevices = nullptr; // Array of IMFActivate pointers.
UINT32 count = 0; // Number of elements in the array.
~ChooseDeviceParam()
{
if (ppDevices != nullptr)
{
for (UINT32 i = 0; i < count; i++)
{
SafeRelease(&ppDevices[i]);
}
CoTaskMemFree(ppDevices);
}
}
};
HRESULT VideoSourceList::InitVideoDevices()
{
m_videoDevices.clear();
HRESULT hr = S_OK;
ChooseDeviceParam param;
CComPtr<IMFAttributes> pAttributes;
// Initialize an attribute store to specify enumeration parameters.
hr = MFCreateAttributes(&pAttributes, 1);
if (!SUCCEEDED(hr))
{
return hr;
}
// Ask for source type = video capture devices.
hr = pAttributes->SetGUID(
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID
);
if (!SUCCEEDED(hr))
{
return hr;
}
// Enumerate devices.
hr = MFEnumDeviceSources(pAttributes, ¶m.ppDevices, ¶m.count);
if (!SUCCEEDED(hr))
{
return hr;
}
for (UINT32 n = 0; n < param.count; ++n)
{
WCHAR name[1024];
hr=param.ppDevices[n]->GetString(MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME, name, 1024, NULL);
if (!SUCCEEDED(hr))
{
return hr;
}
VideoDeviceData data;
data.name = name;
m_videoDevices.push_back(data);
}
return S_OK;
}
这是视频来源列表.h
#pragma once
#include "atlbase.h"
#include <memory>
#include <vector>
class VideoSourceList
{
public:
VideoSourceList();
virtual ~VideoSourceList();
HRESULT GetVideoSourceCount(int& count);
HRESULT GetVideoSourceName(int index, CComBSTR& name);
private:
struct VideoDeviceData
{
CComBSTR name;
CComPtr<IMoniker> moniker;
};
std::vector<VideoDeviceData> m_videoDevices;
HRESULT InitVideoDevices();
};
这是不工作部分的属性
谢谢你的帮助。
好吧,我认为这是因为 2 个不同的 cpp 文件具有名为 ChooseDeviceParam 的结构,所以我重命名了其中一个(ofc 重命名了项目中此结构的所有出现(,现在我不再收到此错误(出现了新错误,但我认为它们与此问题无关(
相关文章:
- 大于65535的C++数组[size]引发不一致的溢出
- 在 C++(和 C)中进行类型转换时明显不一致
- 填充上编译器生成的复制构造函数之间的不一致
- 犰狳的 print() 方法和 cout 在从 Rcpp 调用时顺序不一致
- CreateDIBSection为同一图像返回不一致的位图位值
- 在 Qml 中从 QSqlTableModel 中删除单行时视图不一致
- 模板参数推导不一致
- 声明中不一致的no是否违反ODR?
- 如何删除分支因子不一致的树,最大为 30,40
- SFML 中的字体.信息不显示在屏幕上.显示的不是信息,而是点
- 从 C++ 函数与 Python 函数返回的不一致值用于偏斜正态分布
- 从 C 字符串构造 std::string 与从另一个 std::string 构造 std::string 不一致
- 这种比较是否不一致(或者存在其他问题)?
- 以下可变参数模板行为是否不一致?
- 如何修复我的链表读数不一致的问题?
- 在C++17中,为什么类模板和函数模板的指针类型推导明显不一致
- 多线程程序中的分段故障和gdb回溯上的不完整信息
- void 函数中的指针参数返回不一致的值
- 如何查找导致结果不一致的代码
- 元数据操作失败LNK2022错误 (8013118D):重复类型中的布局信息不一致 (选择设备参数):(0x020002