简体   繁体   中英

How to compile and build a very simple Gnu linux application to Windows using Mingw or Cygwin?

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:

  1. installing Cygwin

    1. http://cygwin.com/setup.exe
    2. C:/cygwin
    3. make sure checked all gcc/g++/svn/wget etc...
  2. install apt-cyg (good if it was default)

     wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg install apt-cyg /bin 
  3. figured out that, this are related libraries for your apps

     apt-cyg install libxml2 iconv bison flex pkg-config 
  4. install Linux apps to Windows apps

     wget site/download/staffs tar xvfz staffs.tar.gz # your time saver apps ./configure make make install 

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 and make and everything works fine.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM