【发布时间】:2015-12-16 14:26:13
【问题描述】:
我目前正在将一个工具移植到 Linux。我正在为此使用单声道,并且已经运行了主要工具。但是,此工具调用另一个程序,该程序是用 C++ 编写的,并在 Linux 上使用 g++ 本地编译。我在移植它时遇到了很多困难,但是让它工作并运行(使用 ./othertool.exe 按预期运行)。
但是,当尝试在 Mono 上运行原始工具时,它无法启动另一个工具,并出现错误。
run-detectors: unable to find an interpreter for .../othertool.exe
我不确定为什么会发生这种情况,因为在使用 hello world 进行测试时,我设法通过在 Mono 上从 C# 调用 C++ 程序来运行它。我正在使用 Process 类(参见代码)运行另一个工具,该类与 hello world 示例配合得很好。
var process = new Process
{
StartInfo =
{
FileName = baseDir +
Path.DirectorySeparatorChar +
"tools" +
Path.DirectorySeparatorChar +
"othertool.exe",
Arguments = arguments.ToString(),
UseShellExecute = false
}
};
process.Start();
process.WaitForExit();
有人知道为什么会这样吗?谷歌没有产生任何东西,所以我想这可能并不常见。随意询问更多信息或澄清,因为我可能遗漏了一些东西。
【问题讨论】:
-
使用
mono作为您的filename并将基于CIL (exe) 的程序集作为参数传递 -
不是CIL,其他工具是在linux上用g++原生编译的。我在问题中添加了这个。
-
othertool.exe是本机 c++/c 可执行文件吗?您是否注册了.exe内核/外壳扩展?如果是这样,请尝试从文件中删除.exe扩展名。 -
这没什么区别。 hello world 示例在编译为
.exe的 c++ 程序时运行良好。 -
假设您使用的是 Linux disto(如Ubuntu)支持启动 PE 格式但没有安装 Wine 之类的东西,你会失败。恕我直言:在 Linux 上将非 PE/非 CIL 文件命名为
.exe是错误的形式...