Use Cygwin to migrate Linux projects to Windows Summary (GO) original http://my.oschina.net/michaelyuanyuan/blog/68615?p=1 why got a task to transplant a project that was developed under Linux (that is, a program) to Windows, so that it could run under Windows, and that the result of the operation was, of course, correct, and, of course, the result of the Linux run, Just like that. Second, difficult where difficult is difficult in how to compile under Windows. Suppose you developed a program like this under Linux: #include <stdio.h> int main () { & nbsp printf ("Hello world\n"); return 0; } that I mean no pressure under porting windows, This program does not use Linux-unique APIs. But when you use Linux-unique APIs in your program, there's a lot of work to do with porting them. Three, basic ideas Do the worst, your program uses a lot of Linux unique API (in fact, you can not say that all the Linux unique API), and then ported to Windows, Compile the error: The xxx.h header file is not found, it is obvious that this xxx.h header file is not in Windows, and then some of the functions declared in the header file are not Windows, or Windows similar API is not placed in this header file declared. At this point, you consider commenting out the #include<xxx.h>, and then compiling, no accident should be an error: a function is undefined. So this is where the referenced function in Xxx.h is found. So next, you should consider whether Windows has a corresponding function to complete similar work, if you are not familiar with Windows, sorry, can only check the Internet. MSDN is a great place to be. Suppose you find the corresponding function in Windows, try to change #include<xxx.h> Change to #include<yyy.h>(Yyy.h is the declaration header file for the API that corresponds to Windows), and the following calls are made with minor modifications. Then verify that the results are correct. Suppose you can't find the corresponding function under Windows, sorry, you have a cup. You have to find information on your own or from the Internet to construct a new API in the context of Windows, which is generally cumbersome and frustrating. Iv. New Hope Let's stop and think about it, there are so many good things under Linux, many things people want to transplant to Windows, but do you encounter this problem alone? The answer is no, there are countless people who have encountered this problem. Maybe you're wondering, is there a tool that uses some of the Windows functions to implement Linux-unique APIs? Congratulations, really! below please cygwin grand appearance. V. What is cygwin What is the introduction of Cygwin in this, it is better to look directly at the encyclopedia, of course, not Baidu Encyclopedia, is a wiki encyclopedia. http://zh.wikipedia.org/wiki/cygwin Six, Cygwin How to use This is the focus, the following talk about the use of the process, pro-test. Download Cygwin, install Cygwin, this is not much to say ... PS: In the installation of Cygwin, if you do not understand the choice of all, but the price is at least 10g+ hard disk space, and do not know how long, I hung up two. After installation, remember to add C:\cygwin\bin to the environment variable path, and then start Cygwin, see a shell interface (small black box), and then put the project under/home/michael, and then into the corresponding directory, Make It's amazing, it just passed ... Then it is best to change the target of makefile to Xxx.exe, and then you try to drag the Xxx.exe out of the double-click Run or put cmd inside with parameters run, is not successful?
Summary of projects that use Cygwin to migrate Linux to Windows (GO)