c# - 从在 Mono 上运行的 C# 进程运行 C++ 应用程序。运行检测器错误

标签 c# c++ linux mono

我目前正致力于将工具移植到 Linux。我正在为此使用单声道,并且已经运行了主要工具。但是,此工具调用另一个程序,该程序是用 C++ 编写的,并在 Linux 上使用 g++ native 编译。我在移植它时遇到了很多困难,但让它工作并运行(按预期运行 ./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();

有人知道为什么会这样吗? Google 不会产生任何结果,所以我猜这可能并不常见。随意询问更多信息或澄清,因为我可能遗漏了一些东西。

最佳答案

好吧,事实证明我在某种程度上使用了 othertool 的 Windows 内置版本,而不是 Linux 版本。是谁让这种事发生的?使用正确的时运行“正常”。 – 卡梅伦

很酷的运行检测器/解释器故障通常(总是?)与 PE 可执行文件 (.exe) 问题(以及其他非 Linux 二进制文件)有关,假设您使用的是 Linux disto (像 Ubuntu)支持启动 PE 格式但没有安装 Wine 之类的东西,你会失败。恕我直言:将非 PE/非 CIL 文件命名为 .exe 在 Linux 上是错误的格式... – SushiHangover

关于c# - 从在 Mono 上运行的 C# 进程运行 C++ 应用程序。运行检测器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34314557/

相关文章:

c# - 如果字段类型没有默认构造函数,如何使用 ValueResolver?

c# - 在 `ZipArchive` 命名空间中找不到 “System.IO.Compression”

c++ - OpenCV 中的连接组件

c++ - 如何使用extern类?

linux - 如何在ubuntu终端中获取一天中的星期几

c# - 如何实现搜索?

c# - 如何从 Windows 服务访问 WCF RIA 服务?

c++ - 如何将 boost::iostreams::null_sink 用作 std::ostream

linux - 带独立应用程序的嵌入式 Linux

c - Pcap 函数有 "undefined reference"