0
我想將.net dll導入到C++項目中。 下面的代碼C++代碼constains:將C#dll導入C++項目?
#include "stdafx.h"
#import "RemoteAgentLibs.tlb" named_guids raw_interfaces_only
int main() {
HRESULT init = CoInitialize(NULL);
if (init != S_OK) return 1;
ImportedNamespace::_ClassNamePtr myclass;
myclass = new ImportedNamespace::_ClassNamePtr("ImportedNamespace.ClassName");
myclass->MyMeyhod();
}
一切正常,直到我檢查「登錄大會」在我的.NET項目的性質。 在.NET項目,我得到警告:
Warning 3 "path to dll" does not contain any types that can be unregistered for COM Interop.
Warning 3 "path to dll" does not contain any types that can be registered for COM Interop.
在C++項目中,我得到錯誤:
error C2039: 'MyMethod' : is not a member of 'ImportedNamespace::_ClassNamePtr'
有人能告訴我爲什麼會出現與進口強名稱problme簽署的dll? 還是有任何其他方式來導入我的dll到c + +項目,並將dll添加到GAC
是您的C++項目強名稱簽名?通常他們都必須是。 –
我認爲這是我的C++項目中的屬性 - >配置屬性 - >鏈接器 - >高級 - > KeyFile我有我用來簽署.net項目的相同文件的路徑 – user3227048