< 返回版块

bell 发表于 2021-09-06 15:05

\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcompiler_builtins-0f3806ca1d72c7be.rlib" "kernel32.lib" "ws2_32.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\Users\xiake\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "/OUT:D:\other\github\rust_nav\testffi\target\debug\deps\testffi.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\Users\xiake\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\intrinsic.natvis" "/NATVIS:C:\Users\xiake\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\liballoc.natvis" "/NATVIS:C:\Users\xiake\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libcore.natvis" "/NATVIS:C:\Users\xiake\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libstd.natvis" = note: navapp.lib(pch.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance Creating library D:\other\github\rust_nav\testffi\target\debug\deps\testffi.lib and object D:\other\github\rust_nav\testffi\target\debug\deps\testffi.exp navapp.lib(navapp.obj) : error LNK2001: unresolved external symbol "public: class KBEngine::SmartPointer __cdecl KBEngine::Navigation::findNavigation(class std::basic_string<char,struct std::char_traits,class std::allocator >)" (?findNavigation@Navigation@KBEngine@@QEAA?AV?$SmartPointer@VNavigationHandle@KBEngine@@@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) navapp.lib(navapp.obj) : error LNK2001: unresolved external symbol "public: class KBEngine::SmartPointer cdecl KBEngine::Navigation::loadNavigation(class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::map<int,class std::basic_string<char,struct std::char_traits,class std::allocator >,struct std::less,class std::allocator<struct std::pair<int const ,class std::basic_string<char,struct std::char_traits,class std::allocator > > > > const &)" (?loadNavigation@Navigation@KBEngine@@QEAA?AV?$SmartPointer@VNavigationHandle@KBEngine@@@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$map@HV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$less@H@2@V?$allocator@U?$pair@$$CBHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@2@@5@@Z) navapp.lib(navapp.obj) : error LNK2001: unresolved external symbol "protected: static class KBEngine::Navigation * KBEngine::Singleton::singleton" (?singleton@?$Singleton@VNavigation@KBEngine@@@KBEngine@@1PEAVNavigation@2@EA) D:\other\github\rust_nav\testffi\target\debug\deps\testffi.exe : fatal error LNK1120: 3 unresolved externals

C++部分

DLLEXPORT KBEngine::NavigationHandlePtr* get_nav_handle(char* resPath_);

typedef SmartPointer NavigationHandlePtr;

template class SmartPointer : public ConstSmartPointer { public: typedef ConstSmartPointer ConstProxy;

SmartPointer(T* obj = 0, typename ConstProxy::REF_TAG tag = ConstProxy::NEW_REF):
ConstProxy(obj, tag)
{
}

SmartPointer( const SmartPointer<T>& P ) : ConstProxy( P ) { }

template<class DerivedType>
SmartPointer( ConstSmartPointer<DerivedType>& dt ) :
	ConstProxy( dt.get() )
{
}

代码太长省略

求大佬给点提示 实在找不到原因

评论区

写评论
作者 bell 2021-09-06 21:53

请问大佬 有没有rust这边调用C++那边的对象的案列库 主要看看C怎么胶水代码的 推荐下

--
👇
Mike Tang: 发出来不看看效果?md语法不用一下?也不说明问题,这样乱糟糟指望谁来帮你。

作者 bell 2021-09-06 21:50

C++ 里面暴露给rust的函数,返回的是一个执行对象的指针,rust那边将该返回值定义未 c_void,能够这样使用吗?

--
👇
Mike Tang: 发出来不看看效果?md语法不用一下?也不说明问题,这样乱糟糟指望谁来帮你。

Mike Tang 2021-09-06 21:06

提问的基本艺术,有必要学一下。

Mike Tang 2021-09-06 21:05

发出来不看看效果?md语法不用一下?也不说明问题,这样乱糟糟指望谁来帮你。

1 共 4 条评论, 1 页