fatal error: mach-o/dyld.h: No such file or directory

fatal error: mach-o/dyld.h: No such file or directory

我正在尝试在我的 Ubuntu 14: https://github.com/Bohdan-Khomtchouk/HeatmapGenerator/blob/master/HeatmapGenerator2_Macintosh_OSX.cxx 上编译这个 src。

要编译此源代码,请执行:fltk-config --use-images --use-gl --compile HeatmapGenerator2_Macintosh_OSX.cxx

但是,我检索到以下错误:

HeatmapGenerator2_Macintosh_OSX.cxx:52:25: fatal error: mach-o/dyld.h: 
No such file or directory
  #include <mach-o/dyld.h>
                          ^
compilation terminated.

我调查了 http://ubuntuforums.org/showthread.php?t=1623945,但它并没有帮助解决我的问题。

#include <mach-o/dyld.h> 不是 Ubuntu 中有效的预处理器指令吗?网上好像很少写这方面的。也许它是 Apple 特定的库,可能未包含在 Ubuntu?

非常感谢任何有关如何绕过此错误并成功生成二进制可执行文件的建议。

编辑:

当我注释掉 #include <mach-o/dyld.h> 预处理器指令时,出现以下错误:

HeatmapGenerator_Macintosh_OSX.cxx:568:13: error: use of undeclared identifier
      '_NSGetExecutablePath'
        if (_NSGetExecutablePath(path, &size) == 0)

有没有一种方法可以在不使用此预处理器指令的情况下绕过此错误? _NSGetExecutablePath 只在 src 中使用过一次,也许还有其他选择...

该源代码根本无法在 Linux 下编译,因为它旨在使用 OSX 的 dylib(动态加载器)而不是 Linux 的动态加载器装载机.

可能的解决方案:

  • "Port" 源代码从 OSX 到 Linux.
  • 使用OSX编译文件。