Can I execute vs2012 compiled binaries on win2k3? - c

I am compiling C projects with vs2012 ultimate on win2k8r2 machine.
But I want to execute same binaries on win2k3 server.
can I do it with modified setting in vs2012?

As far as i know, if you want to make native app built by vs2012 work on Windows xp and Windows Server 2003, you must have vs2010 installed.
There're some configurations to make vs2012 use vs2010's compiler to build apps.

When you compile your binary, linker will link you executable with runtime library. This runtime library can be different on win2k3 server and win2k8.
But, just try :-)
Also, you can set the compiler to use static linking in the project settings (Project -> Properties -> Config Properties -> C/C++ -> Code Generation -> Change "Runtime Library" to /MT or /MTd instead of the default /MD or /MDd)

As released at RTM, native applications built with Visual C++ 2012 would not run on Windows XP or Windows Server 2003 - they would only run on Vista or later.
However, Microsoft will release an update that supports Windows XP and Windows Server 2003 as targets (they will still be not supported as the development platform):
Targeting Windows XP with C++ in Visual Studio 2012

Related

How to target multiple versions of Windows

I am using visual studio 2017 and Windows 7 (sp1). I compiled a c program on my computer. But, On my friend's computer, it's not running. I don't want to share my source code. My friend uses windows 10. How can I compile my program to run on both computers.
Thank you!
To make a compiled deliverable that works on other machines in Visual Studio, what you need to do is:
Compile in Release mode (it is Debug by default)
Ship the appropriate Visual C++ Redistributable package with your executable
Ensure that the target architecture (x86, x64, ARM, or Itanium) is appropriate for your particular deliverable
Creating a setup wizard makes a lot of this easier.
Also note that Windows SmartScreen will by default not allow computers to run foreign, un-digitally signed programs acquired from the Internet.

Running a C program written in Visual Studio 2013 on other pc

Every time I write a C program using Visual Studio 2013 the .exe file only runs on my PC. When I copy that .exe file to other PC it doesn't run. But if I use Code Blocks IDE instead the .exe file runs in all PCs. Why? and how can I make a 'C program' written in 'Visual Studio 2013' run on every PC?
It's because of the 2013 runtime libraries1, you need to download the redistributable and install it into the target computer.
You can download it from here.
1The file is called msvcr120.dll if you compiled with the VS 2013 ("v120") platform toolset, and otherwise follows the pattern msvcrNNN.dll.
In your project settings, change the Runtime Library support to Multi-threaded (/MT) instead of the default, which is Multi-threaded DLL (/MD). This will cause your .exe to be statically linked, and it won't need to look for the runtime libraries on the target machine. (I think it's under C/C++ Code generation, but I don't have visual studio 2013 installed at that moment to verify that).
The resulting .exe will be bigger (because it has to link in all the parts of the runtime that you use), but it simplifies deployment on other machines - no need to install the redist package.

Invoke cl (Visual Studio 2013) cross-compiler from CMD on 64bit Windows

I have downloaded the LiE software
http://wwwmathlabo.univ-poitiers.fr/~maavl/LiE/
Unfortunately, I work on Windows 7 (64 bit) but the code seems to only target 32-bit Linux platforms (i.e. there is only a Makefile that uses the GNU make + gcc).
My idea is to install the GNU make (and some other required tools) for Windows from GnuWin32 and adapt the provided Makefile to the Windows-environment by replacing gcc calls by calls to the VC++ 32-bit cross-compiler. However, when I try to invoke the cross-compiler from the command prompt, I get the error "The dll mspdb120.dll is missing". The question is: How do I invoke the cross-compiler from the command-prompt/GNU make for Windows without copying dlls around? Btw invoking the native 64 bit compiler goes off without a hitch by just calling the cl.exe by its fully specified name!
Thanks a lot!
P.S. I'm using MS Visual Studio Express 2013 and the native-compiler is stored here:
C:\Software\Development\Microsoft Visual Studio 2013\VC\bin\
The cross-compiler is, as expected, stored one level deeper:
C:\Software\Development\Microsoft Visual Studio 2013\VC\bin\x86_amd64
P.P.S.: I have tried to create a MS Visual Studio solution but the Makefile compiles three exe-files, the bison-parser is called externally + multiple source files are merged into a single object file -- the requirements that are extremely hard to implement using the VS-functionality -- so I have abandoned this futile endeavour.
From the Windows command prompt, run the command C:\Software\Development\Microsoft Visual Studio 2013\VC\bin\x86_amd64\vcvarsx86_amd64.bat. That will set up the PATH and other environment variables that need to be set to use the Microsoft compiler normally. You'll need to rerun this command every time you open the Windows command prompt.
You can also use a shortcut included with your Visual Studio 2013 installation that will run this script automatically while opening a command prompt. It's located in the Start menu under Visual Studio 2013 -> Visual Studio Tools -> VS2013 x64 Cross Tools Command Prompt. You can also find it at at C:\Software\Development\Microsoft Visual Studio 2013\Common7\Tools\Shortcuts\VS2013 x64 Cross Tools Command Prompt.lnk.

C files compilation for Win CE 6

I am having c application files and one windows CE 6 device. I want to cross compile these files and run on the device. Which tool can be used for compilation?
Visual Studio 2008 was the last IDE from Microsoft to support Windows CE 6.0. See here for details. You may also need to install an SDK for your POS device.

Interop Forms Toolkit DLL and "Class does not support Automation or does not support expected interface" error

I have a .NET WinForms application that I've converted into a COM dll using the Interop Forms Toolkit 2.1. Thet setup project for the application has both my tlb as well as the Microsoft.InteropFormTools.tlb file set to Register as vsdrpCOM. The prerequisites for the project are to ensure that Windows Installer 3.1, .NET Framework 3.5 SP1, and the Microsoft Interop Forms Redistributable Package 2.0a is installed.
When I run this locally on a Windows XP box with both Visual Studio 2010 and Visual Studio 6 installed, it works fine. However, on this Windows XP machine, I receive an error stating: "Class does not support Automation or does not support expected interface."
Any ideas?
I got it. For those of you that are running into the same, do the following:
Go into Visual Studio 2005, 2008, or 2010 (I used 2010) and build your Interop Form.
Then, go into Visual Basic 6. If your library is not already referrenced, reference the
library.
Build your VB6 executable.
Go back into Visual Studio (.NET version) and build only your installer. This way the installer and VB6 both have the same .tlb file
You're good to go. Thanks for the suggestion Kris!
You have RegAsm the assembly (see stackoverflow for more) on the machine you want to install the application on. The assembly should also be in the directory where the VB6 application runs, or installed in the GAC.

Resources