Is it possible to compile Windows binaries on a Linux machine? - windows

At my work, all of the project data resides on an NFS that is accessible from both Linux and Windows machines (using Samba). All of the work is done on Linux, but I'm toying with the idea of compiling some of tools for Windows so that I can debug with Visual Studio.
I already have a nice makefile that can build the code for both 32-bit or 64-bit Linux using different targets. Assuming I have Windows versions of all the external libraries somewhere on the NFS, and assuming the code is clean enough to compile under Windows, is it possible to compile and link my program for Windows using the existing makefile, on Linux? Ideally I'd like to call the makefile once and have it build all three of 32-bit Linux, 64-bit Linux and Windows.
An added plus would be the option to compile it with any Visual Studio metadata to make it easy to debug.

Yes, you can achieve that with MinGW for example.
However, you will probably have to adapt one or two options in your makefile.

There are a number of possibilities I can think of:
You might try running Visual Studio under Wine. If Visual Studio does not run, you may still be able to run the command-line tools.
Run a full installation of Windows in a Virtual Machine. I have done this with Linux on Windows, but not the other way around, but I am certain that it is possible.
Use VNC to access a separate Windows PC from the Linux PC
Use a cross-build of GCC instead of Visual Studio

You need a cross-compilation package. You can also use the Wine lib.

Related

Loading DLL on OSX

A repository has a C project in Visual Studio. The project is going to run on a mobile device. I am on OSX and would like to compile and contribute to the project. (Assume parallels is not an options, that I do not have a Windows license or a Visual Studio license) Just downloading the C files would be enough except they are also using DLL which are also windows only.
Is there any way I can reconstruct this in an OSX compiler so I can build the files?
It looks like you need a cross-compiler that produces a Windows binary on Mac OS X.
Have a look at the MinGW compilers for Mac OS X available here. You won't be able to use the existing Visual Studio project but MinGW should be sufficient to compile the C files and link to the provided DLLs.
You can download and install Wine using MacPorts or you can just use WineSkin which is a GUI Wrapper for Wine on MacOS X. Go and grab Visual Studio 2010 Express Edition ISO image and install the application on Wine. Then you can open the VS project and try compiling it.
Based on your comments I think you need to run Windows DLLs on OSX without using a Windows VM. Assuming that you can't recompile the DLLs to target OSX, I think that your only realistic solution is to use Wine.

problem to make turbo c++ program run with vs c++ 2010

I have a code which works on turbo c++...However i would like to use it on visual studio c++ 2010 in windows 7. Is there a way to do it...If yes please let me know the same...or else what is the other way to do it...
If you are using headers like "dos.h", "graphics.h" and so on, you won't be able even to compile your project. So, be carefull.
But there is one way to compile and run any of your projects on Windows 7 - you can install some DOS emulator or virtual machine (like VirtualBox) and use 'em for bcpp or tc. The point will be that you will be running emulation of DOS, not the native application. Thereby none of WinNT does not supports native DOS =)

Is it possible to run applications compiled by Visual Studio 2008 on Linux?

Is it possible to run applications compiled by Visual Studio 2008 on Linux? Is there plugin that can convert my project exe to a Linux runnable file?
As far as I know, there is no software that allows Visual Studio to generate non-Windows executables.
If it's a native executable (not .NET) you can try running it under WINE and see if that works. If it doesn't I'd guess the options are either to make it work with WINE or see if you can build it as a native Linux application. The latter will be rather painful if it's a GUI application, obviously, and I'd question if it is worth it. Porting a command line app might be doable but don't underestimate the work involved.
if you use dot net there is a MONO library that enables running some dot net application on linux.
but it not fully compatible.
Otherwise you can do it, (maybe using silverlite you would...)
Mono Project

What is the best way to build open source libraries DLLs for Windows developers to use?

I have several C free software/open source libraries that I develop on Linux and OSX with the GNU toolchain (automake, conf, flex, bison, gcc, ...) but I occasionally get requests to provide Windows DLLs. I'd like to be able to provide those without having to spend a lot of time and money with Windows Visual Studio development. I do have a Windows XP virtual machine available and I also know the software is portable as occasionally I get patches to make it build in on windows.
What approaches or tools should I be using? Cross compiling on Linux? using Visual Studio Express or something else? I would prefer something that is fully automated from a SVN repository. I do not count cygwin as a solution since that does not seem to provide what Windows developers need, as far I understand the issues - linking and DLLs.
You can try Mingw with MSYS, Visual Studio (Express) with SUA (subsystem for unix application) or Cygwin to compile programs that are automake/autoconf based (./configure && make to build under linux).
Unfortunately usually the lib file they create is not compatible with other compilers, so if you want your library to work with an application that is developed using Visual Studio, then you should use the VSC++ approach. Usually a lot of GNU projects (check gnuwin32) actually have VC compatible build scripts too, than can be compiled using "nmake"
You could use MinGW or install the MSVC command line tools from Visual Studio Express.
Either of those can be driven by command line scripts.
I imagine a cross compile from Linux would also work, but I have no idea how easy (or painful) that might be to get going.
This short article shows a simple cross compile of a Windows application & running that app under Wine:
http://www.linuxjournal.com/node/1005753
The Windows Software Development Kit includes Microsoft's C/C++ compiler (command line only with no visual tools), so you don't even need Visual C++ Express Edition. The Windows SDK is a free download from Microsoft.
If you're using http://www.cmake.org/, cmake can create the Makefile (for Unix) and project file (for Visual Studio). This is what for example the KDE project is using.
Visual Studio's compiler can be started from a Windows command line with 'devenv /build debug project.csproj' on the cmake generated file. This does however require a Windows (possibly in a VM) with a (potentialy free) Visual Studio installed.

Producing 64-bit builds on Windows with free software

I have a C++ project that I've been developing in Microsoft Visual C++ 2008 Express Edition. It has come to the point that I'd like to port to 64-bit and continue development.
What is the best way to do this using free software?
My thoughts so far:
The Express Edition of MSVC doesn't come with 64-bit compilers, so I can install the Windows SDK to get these. I could then port my project files to nmake, and use the IDE just as a tool to debug and invoke my nmake scripts.. The downside to this is that nmake looks very poor. The example towards the end of this tutorial suggests that nmake cannot figure out source file dependences itself, and I don't know of anything equivelant to gcc -M that I could use.
Another option might be to use vcbuild from the Windows SDK to produce 64-bit builds from my existing vcproj files. Preliminary investigations show that this doesn't really work, as my project files don't have the 64-bit configurations present. (Perhaps I could fudge this by adding the 64-bit configurations to the vcproj files in a text editor.)
A final option might be to give up on MSVC, and port my project to the MinGW/MSYS toolchain.
You can use makedepend as an alternative to gcc -M. Here's a primer on this and other methods of generating dependencies.
You could also give the autoconf+automake combo a try, though it requires some work to make it use MSVC's compiler. Some have succeded at doing this.
If you want to use the Windows SDK compiler with GNU make or another build system, you could write a program/script that converts the output of cl.exe /showIncludes into a format that is compatible with your build system.

Resources