[英]C++ CLR error after adding function to .h file
I'm not a C++ programmer but rather a "code editor", so I hereby apologize sincerely in advance for the question in general. 我不是C ++程序员,而是“代码编辑器”,因此对于一般的问题,我在此谨此致歉。
For some broadcasting software I am editing a plug-in to give it interoperability between native C/++ and CLR (C#). 对于某些广播软件,我正在编辑一个插件,以使其在本机C / ++和CLR(C#)之间具有互操作性。
The host software: OBS (Open Broadcaster Software) - obsproject.com 主机软件:OBS(开放广播软件)-obsproject.com
The plug-in: CLR Host Plugin - github.com/kc5nra/CLRHostPlugin 插件:CLR主机插件-github.com/kc5nra/CLRHostPlugin
What I want to do is exposing functions from OBS to some CLR libraries, the total list of exposible functions can be found here: https://github.com/jp9000/OBS/blob/master/OBSApi/APIInterface.h#L198 我想做的是将OBS中的功能公开给某些CLR库,可在此处找到可公开功能的总列表: https : //github.com/jp9000/OBS/blob/master/OBSApi/APIInterface.h#L198
Now the plug-in is a proxy between the languages and exposes some of the functionalities named above through API.h/cpp, https://github.com/kc5nra/CLRHostPlugin/blob/master/CLRHostInterop/API.h . 现在,该插件是这些语言之间的代理,并通过API.h / cpp, https: //github.com/kc5nra/CLRHostPlugin/blob/master/CLRHostInterop/API.h公开了上面命名的一些功能。 What I want to do is adding more functions to API.h to expose them to CLR libraries.
我想做的是向API.h添加更多功能,以将其公开给CLR库。
When I add a function in API.h, line 51, it'll give me linker errors. 当我在API.h的第51行中添加函数时,它将给我链接器错误。
namespace CLROBS
{
public ref class API
{
public:
void AddSettingsPane(SettingsPane^ settingsPane);
void AddImageSourceFactory(ImageSourceFactory^ imageSourceFactory);
IntPtr API::GetMainWindowHandle();
void Log(System::String^ format, ...array<System::Object^> ^arguments);
System::String^ GetPluginDataPath();
void SetChangedSettings(bool isChanged);
int GetMaxFPS();
void StartStopStream(); // Addition to the original.
};
};
#include "OBSApi.h"
#include "API.h"
#include "CLRHostApi.h"
#include "OBSUtils.h"
using namespace System::Runtime::InteropServices;
// Default code......
int API::GetMaxFPS()
{
return ::API->GetMaxFPS();
}
void API::StartStopStream()
{
OBSStartStopStream();
}
error LNK2022: metadata operation failed (80131187) : Inconsistent method declarations in duplicated types (types: CLROBS.API; methods: StartStopStream): (0x0600006c). <DIR>\CLRHostPlugin\CLRHostInterop\API.obj CLRHost.Interop
error LNK2022: metadata operation failed (80131187) : Inconsistent method declarations in duplicated types (types: CLROBS.API; methods: StartStopStream): (0x0600006c). <DIR>\CLRHostPlugin\CLRHostInterop\AbstractPlugin.obj CLRHost.Interop
error LNK2022: metadata operation failed (801311D6) : Differing number of methods in duplicated types (CLROBS.API): (0x02000008). <DIR>\CLRHostPlugin\CLRHostInterop\API.obj CLRHost.Interop
error LNK2022: metadata operation failed (801311D6) : Differing number of methods in duplicated types (CLROBS.API): (0x02000008). <DIR>\CLRHostPlugin\CLRHostInterop\AbstractPlugin.obj CLRHost.Interop
The in my eye's odd behaviour doesn't occur when using the plain code 使用普通代码时,不会发生我眼中的奇怪行为
namespace CLROBS
{
public ref class API
{
public:
void AddSettingsPane(SettingsPane^ settingsPane);
void AddImageSourceFactory(ImageSourceFactory^ imageSourceFactory);
IntPtr API::GetMainWindowHandle();
void Log(System::String^ format, ...array<System::Object^> ^arguments);
System::String^ GetPluginDataPath();
void SetChangedSettings(bool isChanged);
int GetMaxFPS();
// - commented out - void StartStopStream(); // Addition to the original.
};
};
Added API.cpp snippet 添加了API.cpp代码段
Even when I comment out OBSStartStopStream(); 即使当我注释掉OBSStartStopStream()时; on API.cpp the error still exist.
在API.cpp上错误仍然存在。
Please assist. 请协助。
Regards, 问候,
MusicDemon MusicDemon
Question canceled. 问题已取消。 Using obs-websocket now.
现在使用obs-websocket 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.