What are the different platforms/languages in which an app can be compiled and run on Windows without any prerequisites? - windows

What are the different platforms/languages in which an app can be compiled and run on Windows without any prerequisites? I know of .NET but it requires the specific version of .NET to be present in the Windows installation.

C and C++, but Visual Studio defaults to dynamically linked library. Change the default to static and you will be fine.
That being said, ther are no compilers that come with windows. You must install a compiler to build the a program that will run everywhere after that. There are free version of the compiler in the Platform SDK and in mingw (Cygwin requires a dll).

If you are using Visual C++ as language and development tool, you may switch to Statically bound DLLs, which would produce larger binaries, but would run without any runtime-prerequisites. Visual C++ Runtimes are easily installable, can be distributed, or users may be asked to install them directly. If users are using Windows Update, they would anyhow get the latest VC runtimes.

Related

Is Microsoft C++ Build Tools available as portable (without installation)

We are currently using CUDA on windows which requires MS C++ Build tools installed. With every new version of the CUDA toolkit it happens that newer versions of Visual Studio are not supported. That's why we are using the MS build tools seperately so that the VS version doesn't matter.
Since its hard to guide our developers to install the right CUDA and MSVC version we have packaged it into NUGET packages so that the toolkit (especially NVCC) is in a defined version and location. Additionally we wanted to do this with MSVC but we couldn't find a good solution since the installer obviously does modifications on several places that we don't know.
Is there any good way to get the MSVC tools portable so that we can simply drop it into a folder and put the right pathes?
NVCC doesn't support GCC, otherwise I would have gone with this.

The SDK windows jungle

I'm kind of lost with all these SDK windows versions.
For instance, I installed vs2013 on windows8.1, and I (also) need to link my apps against vs2008 runtime (platform toolset).
Should I install the whole VS2008 too or just the API. In the last case, what SDK do I have to install ?
You are talking about two very distinct things. The Windows SDK only covers the declarations and libraries that you need to make winapi calls. SDK v8.1 is suitable to target any modern Windows version since Vista, you select the Windows version you want to target by setting the _WIN32_WINNT macro. Note that XP requires an older SDK version, v7.1 is the last one that's still suitable and selected by setting the Platform Toolset to v120_xp.
The runtime libraries are a pure implementation detail of Visual Studio C/C++ projects and completely unrelated to the SDK. When you build such a program on VS2013 with the /MD compile option then it will have a dependency on msvcr120.dll, possibly msvcp120.dll and others. These DLLs implement the C runtime library and the C++ standard classes. And possibly MFC, ATL, OpenMP and AMP if you use those libraries.
If you still have a dependency on the VS2008 version of those libraries then you are liable to have a Really Big problem. You can obtain the release versions of those DLLs from the redist installer you can download from Microsoft. Having a dependency on the debug version requires having VS2008 installed on your machine. But having trouble linking the program and misery at runtime is highly indicated, the runtime libraries changed a great deal between VS2008 and VS2013 thanks to the new C++11 language standard. Having more than one CRT in a program is in general liable to cause lots of trouble.
You need to strongly pursue getting the library that still has the VS2008 dependency rebuilt. Contact the owner of the library if necessary to get an update.

Does it possible to run C++ apps for every type of OS?

I would like to use C/C++ for coding my apps, but I need my apps running on all versions of Windows from XP to Win8, independently by any platforms, run time libraries and so on.
Briefly: What kind/type of C/C++ I suppose to use, be able to run my apps on every type of Windows without any additional installation, just default one. e.g Windows XP SP1
C++ can run on just about any OS, as long as you avoid (or, via conditional compilation, provide alternatives for) anything specific to one OS or version. Win32 code is almost all the same between versions; the main difference is added functionality in newer versions. Between Windows and, say Linux, though? Not so much. You kinda need to pick a platform, unless you want to either stick to text mode (which is pretty close between OSes, thanks to standards) or learn some whole other platform-neutral API like OpenGL, wxWidgets, GTK, etc.
As for which compiler to use, if you're sticking with Windows, I'd recommend Visual Studio. Microsoft has a free (Express) edition that will let you compile Win32 code or .net. (You'll need the paid version, or some playing around with the Platform SDK, to play with 64-bit though.) And the IDE isn't too bad either. If you just want a compiler, the Platform SDK has the same compilers VS has, and includes 64-bit support (and even a bunch of code samples and tools) as well.
As for being independent of any runtime libs: Every C++ compiler that's worth using has a runtime library. If you link statically against it, though, the parts you need will be embedded in your EXE. Alternatively, you have permission to distribute the runtime libs with your app (though you may need to install it via a package they provide, that you bundle together with your app...i forget how all that works).
All popular C++ compilers support XP up. You can statically link the runtime, or, for mingw, you can link against the runtime supplied with Windows.

Installing Qt4 on Windows - do I need to fully install MinGW or just have local copies

That is, can I get away with DLLs in the install directory or does the installer need to ensure that MingW is fully installed?
If you install the Qt SDK, it will actually install its own MinGW tree.
This does not directly answer your question, but generally speaking, to ensure I have all the right dependencies when creating an installer, I do the following:
Use Depends, a Microsoft tool that shows what DLLs a Windows executable (.exe or another .dll) depends on. This will not show dynamically loaded DLLs though, such as QT plugins. I believe Depends is part of the Platform SDK (it used to be, anyway), which you should be able to download. See here for example.
Use a virtualization tool (like VirtualBox or VMWare) to install a fresh copy of Windows and your application. If it complains of missing DLLs on startup, you missed something in the install package.
You should be aware of any dependencies on the Visual C++ run-time. There are many different versions out there, and if your app depends on them, you need to install the correct version to the Windows\WinSxS directory. Microsoft provides a redistributable for each version of Visual C++ (including the express edition, which you can get for free). I only mention this because I noticed when installing Qt SDK that the VC++ redistributable was getting installed, so the Qt DLLs may have a dependency on the VC++ run-time.

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.

Resources