G++从Linux交叉编译到Windows
我试图将C ++应用程序从Linux交叉到Windows。我希望能够像我一直使用的那样使用普通的G ++编译器。
我尝试在网上寻找有关此问题的帮助,但只发现了Mingw或Clang的东西或具有长期复杂设置的东西。
是否有像一行命令一样,我可以使用G ++ -windows将其构建以在此处构建Windows可执行文件。我的代码不使用任何Windows Libaries,因此应该可以编译。
感谢您的帮助。
Im trying to cross compile a c++ application to windows from linux. I want to be able to use the normal g++ compiler as I have always used.
I tried looking online for help on this issue and found only mingw or clang stuff or stuff with a long complex setup.
Is there like a one line command I can use like g++ -windows to get it to build a windows executable right there. My code doesnt use any windows libaries so should compile just fine.
Thanks for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
真的不是那么困难。您唯一需要做的就是安装
g ++ -mingw-w64
与:之后,您唯一需要做的就是编译:
这将为Windows提供64位的可执行文件那只是运行。这就是我的方式,我没有任何问题。
如果您想要32位可执行文件,那就做:
Is really not that hard. The only thing you need to do is install
g++-mingw-w64
with:After that, the only thing you need to do is compile with:
That is going to give you a 64-bit executable for windows that just runs. That's how I do it and I haven't had any problems.
If you want a 32-bit executable just do: