发送 a.out 给某人

发布于 2024-07-30 04:49:14 字数 431 浏览 0 评论 0原文

可能的重复:
Linux 可执行文件是否与 OS X “兼容”? < /p>

在 os x 上使用 GLUT 和 OpenGL 编译一些 C++ 代码。 一切都很好。 我把它作为 a.out

有没有办法将其发送给使用 os x 的人? 会不会有一些奇怪的依赖关系? 我可以将其发送给使用 Linux 的人吗?

我怀疑我能做任何一件事,这就是我在这里问的原因。 我在谷歌上环顾四周,但找不到任何有用的东西,我可能没有在寻找正确的东西,

谢谢

Possible Duplicate:
Is a Linux executable “compatible” with OS X?

I have some c++ code compiled using GLUT and OpenGL on os x.
It all works fine. I have it as a.out

Is there a way to send this to someone using os x? Will there be some weird dependencies?
Can I send it to someone using linux?

I doubt I can do either which is why I'm asking on here. I looked around on google but couldn't find anything useful, I'm probably not searching for the right stuff

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

筱武穆 2024-08-06 04:49:16

应该可以将其发送给与您使用相同版本的 OS X 和相同计算机芯片的人。 甚至可以在 OS X 上交叉编译为可在 Intel 和 PowerPC 芯片上运行的通用二进制文件,但您仍然限于 OS X。

要获得适用于 Linux 的工作可执行文件,您需要编译它在 Linux 上(或者使用交叉编译器,但这可能比它的价值更困难,特别是如果你必须重复这样做)。

或者,正如已经说过的,您可以分发源代码并让人们自己编译它。 这可能是最好的方法,因为 C++ 没有通用的二进制格式,所以如果不同的人使用具有不同形式的名称修改的不同编译器,他们仍然会得到一个可以工作的程序(如果他们用一个编译器编译 OpenGL 或 GLUT) C++ 编译器,然后你用另一个编译器编译你的程序,它们可能无法一起工作(我认为))。

It should work to send it to someone using the same version of OS X and the same computer chip as you. It may even be possible on OS X to cross-compile to a universal binary that works on Intel and PowerPC chips, but you'll still be limited to OS X.

To get a working executable for Linux, you'll need to compile it on Linux (or use a cross-compiler, but that could be more difficult than it's worth, especially if you have to do it repeatedly).

Or, as has been said already, you could just distribute the source code and let people compile it themselves. This may be the best approach, because C++ has no common binary format, so if different people use different compilers that have different forms of name-mangling, they'll all still get a program that works (if they compiled OpenGL or GLUT with one C++ compiler and then you compiled your program with another, they might not work together (I think)).

北城半夏 2024-08-06 04:49:16

只分享源码怎么样?

您是否担心有人会窃取您宝贵的作品?

What about just sharing the source?

Are you afraid somebody's going to steal your precious work?

森林散布 2024-08-06 04:49:14

OS X 和 Linux 具有完全不同的二进制格式(分别为 Mach-O/Universal Binary 和 ELF),因此,在 OS X 上编译的程序不会在 Linux 上运行,除非你交叉编译它。

如果您使用静态链接编译代码,那么其他 OS X 用户将能够正常使用它。 然而,请记住,我对 GLUT 或 OpenGL 知之甚少,我敢打赌,这些都是动态库,因此无论您将其发送给谁,都需要在同一位置安装相同的库才能使用能够使用您编译的代码。

otool -L 将显示可执行文件的链接依赖关系,仅供参考。

OS X and Linux have completely different binary formats (Mach-O/Universal Binary and ELF respectively), so no, a program compiled on OS X won't run on Linux unless you cross-compiled it.

If you compiled your code using static linking, then another OS X user will be able to use it just fine. However, bearing in mind that I know very little about GLUT or OpenGL, I'd bet good money that those are dynamic libraries, and thus whoever you send it to will need to have the same libraries installed in the same place in order to be able to use your compiled code.

otool -L will display the linkage dependencies of your executable, FYI.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文