Mono(Linux,C#):无法找到同一文件夹中的DLL(System.DllNotFoundException)

问题描述 投票:2回答:1

我正在尝试使用mono来运行我的Raspberry Pi 3上的C#程序。程序正确启动,但是一旦我到达使用某些OpenCV库的程序,程序错误就会出现以下输出:

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: opencv_core220
  at (wrapper managed-to-native) Emgu.CV.CvInvoke:cvRedirectError (Emgu.CV.CvInvoke/CvErrorCallback,intptr,intptr)
  at Emgu.CV.CvInvoke..cctor () [0x00023] in <4f43ef68be294203a100f85f9cebb2b6>:0 
   --- End of inner exception stack trace ---
  at Emgu.CV.Image`2[TColor,TDepth].AllocateData (System.Int32 rows, System.Int32 cols, System.Int32 numberOfChannels) [0x0002e] in <4f43ef68be294203a100f85f9cebb2b6>:0 
  at Emgu.CV.Image`2[TColor,TDepth].set_Bitmap (System.Drawing.Bitmap value) [0x00050] in <4f43ef68be294203a100f85f9cebb2b6>:0 
  at Emgu.CV.Image`2[TColor,TDepth]..ctor (System.Drawing.Bitmap bmp) [0x00008] in <4f43ef68be294203a100f85f9cebb2b6>:0 
  at App.Program.Main (System.String[] args) [0x00122] in <b44d2f4f9f83495091806ba3e6a1570f>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: opencv_core220
  at (wrapper managed-to-native) Emgu.CV.CvInvoke:cvRedirectError (Emgu.CV.CvInvoke/CvErrorCallback,intptr,intptr)
  at Emgu.CV.CvInvoke..cctor () [0x00023] in <4f43ef68be294203a100f85f9cebb2b6>:0 
   --- End of inner exception stack trace ---
  at Emgu.CV.Image`2[TColor,TDepth].AllocateData (System.Int32 rows, System.Int32 cols, System.Int32 numberOfChannels) [0x0002e] in <4f43ef68be294203a100f85f9cebb2b6>:0 
  at Emgu.CV.Image`2[TColor,TDepth].set_Bitmap (System.Drawing.Bitmap value) [0x00050] in <4f43ef68be294203a100f85f9cebb2b6>:0 
  at Emgu.CV.Image`2[TColor,TDepth]..ctor (System.Drawing.Bitmap bmp) [0x00008] in <4f43ef68be294203a100f85f9cebb2b6>:0 
  at App.Program.Main (System.String[] args) [0x00122] in <b44d2f4f9f83495091806ba3e6a1570f>:0 

提到的库“opencv_core220”是一个dll,它位于与我使用mono执行的exe相同的目录中。我该怎么做才能解决这个问题?到目前为止我从未使用过单声道,但我读过你不能在linux上使用dll,比如在windows上,但你必须使用so-files。但我不知道如何从我的dlls中获取它们。该程序完全适用于Windows。

c# linux mono raspberry-pi3 dllimport
1个回答
-1
投票

将.dll文件转换为.so文件并将.so文件添加到/ usr / lib。然后运行你的exe并检查

© www.soinside.com 2019 - 2024. All rights reserved.