如何使用 Mingw 或 Cygwin 在 Windows 上编译和构建一个非常简单的 Gnu linux 应用程序?
我想从纯 C/C++ 源代码移植现有的 Linux 应用程序 代码与 Windows XP/Vista/7 具有完全相同的功能,而不会丢失 基本代码可以很好地构建,但问题是 我要移植的应用程序有其他 Linux 依赖项。
问题:如何将具有其他库依赖项的 C/C++ 代码移植到 Windows系统?使用 MinGW。有没有什么 IDE 可以做到这一点?或者第一个 我需要找出依赖库。然后最后构建主 应用?
是否可以建议,这样的应用程序或参考的你好世界 任何真正有效的资源。因为我尝试过自己却失败了 使用 MinGW 构建其他依赖项。跟进:
安装 Cygwin
- http://cygwin.com/setup.exe
- C:/cygwin
- 确保检查所有 gcc/g++/svn/wget 等...
安装 apt-cyg(如果是默认的则很好)
wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg 安装 apt-cyg /bin
发现,这是您的应用程序的相关库
apt-cyg install libxml2 iconv bison flex pkg-config
将Linux应用程序安装到Windows应用程序
wget 站点/download/staffs tar xvfz Staffs.tar.gz # 您的省时应用程序 ./配置 制作 进行安装
I would like to port an existing Linux application from its plain C/C++ source
code to Windows XP/Vista/7 exactly same functionality to have, without losing
few modules here and there etc. Basic codes are fine to build, but problem is
the application I will be porting have other Linux dependencies.
Question: How can I port a C/C++ code which has other libraries dependencies, to
Windows system? Using MinGW. Is there any IDE where I can do that? Or first of
all I need to find out dependent libraries. And then finally build the main
application?
Would it be possible to advise, a hello world for such application or reference
to any resource which really works. Because I tried myself and i get fail
building the other dependencies it has using MinGW. Follow up:
installing Cygwin
- http://cygwin.com/setup.exe
- C:/cygwin
- make sure checked all gcc/g++/svn/wget etc...
install apt-cyg (good if it was default)
wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg install apt-cyg /bin
figured out that, this are related libraries for your apps
apt-cyg install libxml2 iconv bison flex pkg-config
install Linux apps to Windows apps
wget site/download/staffs tar xvfz staffs.tar.gz # your time saver apps ./configure make make install
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MinGW 本质上是极简主义的;它努力不带任何行李。听起来您确实想要行李,在这种情况下,您应该使用Cygwin,它在 Windows 上模拟/实现许多 UNIX 系统调用和库。整个 GNU 工具链都在那里,很多时候你只需运行
./configure
和make
就可以一切正常。MinGW is, by nature, minimalist; it tries hard not to bring any baggage with it. It sounds like you actually want baggage, in which case rather than using MinGW you should be using Cygwin, which emulates/implements many UNIX system calls and libraries on Windows. The whole GNU toolchain is there, and many times you can just run
./configure
andmake
and everything works fine.在模拟层上运行(一个很好的建议)会让你快速前进,但它不是最佳的。
根据您的性能要求,您可能需要重新设计应用程序,以将依赖于 Linux 的代码替换为可移植替代方案(例如 Boost 或其他可移植库代码),或者您自己的特定于 Windows 的替换代码。
Running on an emulation layer (a good suggestion) will get you going quickly, but it will be sub-optimal.
Depending on your performance requirements, you may have to retool the app to replace the Linux-dependent code with either portable alternatives such as Boost or other portable library code, or Windows-specific replacement code of your own.