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.
Related
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.
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.
My WPF application Build is Release Any CPU and Prerequisites are SqlServer,Crystal Report and .NET Framework 4.0 (packed with a setup file together with the application).
Case 1: 32 Bit System
When I run the setup in a 32-bit system, it installs SQL Server 2008 x86, Crystal Reports x86. After installation, application is able to connect SQL Server and open all the Reports from application.
Case 2: 64 Bit System
When I run the setup in a 64-bit system, it installs SQL Server 2008 x64, Crystal Reports x64, but WPF application to Program Files(x86) folder. After installation, application is not able to connect SQL Server and reports doesn't open.
I know the reason that application is installed in Program(x86) folder, but then how to force setup to install in Program Files folder. I have set build to Any CPU
Thanks in advance.
32 bit version works also on x64 systems.
Don't know if that changed but ~2 years ago, there was a blog post from a microsoft guy saying that, unless you really need more than 2GB of memory you should build you applications always with 32 bit. It is also supposedly faster since more pointers fit into the CPU cache (that's what was written in the blog)
Visual Studio 2012 is also a 32-bit build and if you want edit and continue in debug (changing code on the fly, while debugging) it works so far only with 32 bit. (in the next VS it should also work with x64)
so unless you use huge amounts of memory, there is no benefit to compile it as any cpu or even x64 and a huge benefit if you compile it with 32-bit
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
I would like to install Visual Studio 2008 and MS SQL Server 2008 on Ubuntu OS which I have in my PC.
Wine is great, but using it for either Visual Studio or MS SQL Server is probably pushing it. Both are behemoths that tend (especially VS) to use the latest MS APIs. More to the point, both VS and MSSQL are listed as Garbage in Wine's db, meaning compatibility is very poor.
I would recommend you take a serious look at the available tools on GNU/Linux, such as MonoDevelop, Mono, Eclipse, MySQL, etc. You can use cross-platform build technologies, such as nant to build the same apps on both platforms.
If that isn't an option, then you will have to resort to virtualization, as noted by sean.
This answer might help you. Visual Studio and SQL Server are for Windows OS variants. You'll need some sort of VM to run on Ubuntu.
If you have some sort of Windows OS disks available to you (XP / Vista / 2008), then you could consider installing Windows under VirtualBox, and installing your software inside that VM. That used to work really well for me when I was still on Ubuntu.
I've been developing using Visual Studio in Ubuntu since version 10.04, and there is a solution, although I would recommend that you run the 64 bit version of Ubuntu and have at least 4Gb of ram available.
Install the latest version of VirtualBox (download from the website, rather than using the ubuntu repository), and install Windows as a virtual machine. You need to allocate a virtual disk and then, when the virtual machine starts for the first time, either install Windows from a CD/DVD, or select a CD image to use within VirtualBox.
You will also see, with the later versions of VirtualBox, something called "seamless mode". This essential hides the virtual machine, so that instead of running in a window, it will integrate with the Ubuntu desktop. That way, you can run Visual Studio in what looks to be native to Ubuntu.
I have tried both VMWare Player and VirtualBox and found VirtualBox to be better for my setup. Although VMWare Player has something called VMWare tools, which provides an API layer to better translate Windows calls to your video card, this can be temperamental if you're using an ATI card (speaking from experience with a Mobility Radeon HD 4600). Nvidia provide much better driver support in Linux than ATI do.
Hope this helps!
I think is better to simply dual boot to write your .net code. It will put your hardware to better use, and you will be able to focus more since all the programs on which you waste your time will be on the linux side :D (at least that's the upside for me)
To use Visual Studio 2008 and MS SQL Server 2008 in any Linux..
Just try sharpdevelop: http://www.icsharpcode.net/opensource/sd/