Leapmotion的一个错误

在弄leapmotion的时候碰到一个错误,使用Leapmotion自带的SDK可以连接到Leapmotion上。但是私活连接不到Unity中

原文连接:http://desigeek.com/blog/amit/2013/08/14/leapmotion-sehexception/

If for some reason when you try and run your code and you get a PINVOKE exception (like the one below), then most likely you don’t have the LeapMotion binaries in your Debug (or Release) folders.

System.TypeInitializationException was unhandled
HResult=-2146233036
Message=The type initializer for 'Leap.LeapPINVOKE' threw an exception.
Source=LeapCSharp.NET4.0
TypeName=Leap.LeapPINVOKE
StackTrace:
at Leap.LeapPINVOKE.new_Listener()
at Leap.Listener..ctor()
at HelloLeap.MyListener..ctor()
at HelloLeap.Program.Main(String[] args) in c:\Users\amit.bahree\Documents\Visual Studio 2013\Projects\HelloLeap\HelloLeap\Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.TypeInitializationException
HResult=-2146233036
Message=The type initializer for 'SWIGExceptionHelper' threw an exception.
Source=LeapCSharp.NET4.0
TypeName=SWIGExceptionHelper
StackTrace:
at Leap.LeapPINVOKE.SWIGExceptionHelper..ctor()
at Leap.LeapPINVOKE..cctor()
InnerException: System.DllNotFoundException
HResult=-2146233052
Message=Unable to load DLL 'LeapCSharp': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Source=LeapCSharp.NET4.0
TypeName=""
StackTrace:
at Leap.LeapPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_Leap(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at Leap.LeapPINVOKE.SWIGExceptionHelper..cctor()

On the other hand if you get a SEHException from LeapMotion (something like the one below) then the issue is either you don’t have the right version of the assemblies (e.g. you are compiling a x64 version, but have the x32 binaries, or vice-versa).

System.Runtime.InteropServices.SEHException occurred
HResult=-2147467259
Message=External component has thrown an exception.
Source=Your.Some.Assembly
ErrorCode=-2147467259
StackTrace:
at Leap.LeapPINVOKE.Controller_EnableGesture__SWIG_1(HandleRef jarg1, Int32 jarg2)
at Somewhere.In.Your.Code bin
at Some.Assembly in d:\Data\src\SomeCode\YourFile.cs:line 23
InnerException:

The solution is simple in both cases to copy the binaries (which can be found in LeapSDK\lib) to the Debug and Release folders.

解决方案,最后一句:把 binaries文件放到Debug 和Release文件下就可以了,如果解决不了需要把所有‘dll文件放到plugins文件夹下试试。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值