How to compile OpenCV on Windows?

Is it possible to compile C code for Windows under an emulated UNIX environment and then link that with Visual Studio libraries?

  • By "emulated UNIX environment", I mean the likes of Cygwin, where common GNU/BSD utilities (like make, gcc or clang, or automake/autoconf for example) can be used to compile the majority of the code.  I'll suppose in this example that one big project is being built, and that it relies on a number of open source libraries. By mentioning Visual Studio, I'll also suggest that there may be a small core set of functions and methods that are very Windows-centric (platform and device specific) and that these are best written and compiled in Visual Studio.  The other side of that is that the majority of code, as long as it represents pure logic or computation, might be moved to C code that would be compiled using a UNIX toolchain. The portability of Cygwin is also of interest here.  For example, whether or not a user has Cygwin installed, I wonder if it is possible to simply include the Cygwin DLLs in some other self-contained directory, and let those DLLs be a prerequisite of running the resultant linked binary. The central aim is to see to what extent a Windows project can make the most use of a traditional UNIX environment, and whether this can interoperate fully with a built executable or library in Visual Studio.

  • Answer:

    I think its possible. (Please correct me if I am wrong). Beacause Cygwin will convert Linux System calls to Windows calls at the end thus the DLL (not .so) should be fine with Visual Studio.

Puran Chand Rajpurohit at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.