Deploying a project using Visual C++ and the QT plugin for VS2010 - visual-studio-2010

I've created an application in C++ using Visual Studio 2010 as my IDE. I used the QT plugin for Visual Studio to create my GUI and also use the VTK and OpenCV libraries. What is the simplest way to deploy my application? I've already tried pasting the DLLs for QT, VTK, and OpenCV in my exe folder and, although this runs on other computers, the formatting and program speed are wildly different than what I get on my computer.

So, you have 2 possible ways:
Static deploy.
Shared deploy.
Description both of them you can find here
As i see the shared deploy is too difficult for you, because you're using heavy libraries.
So, my advice is that satic deploy will be better :)
Please, try to build Qt, libs, and your app static, and we'll see how it will works.

Related

Compiling the opus-codec API library

First, going to be honest. I'm a c#/java-language-level dweller. So I have no idea about how to compile native-C projects such as opus.
I've tried doing it myself, and I've tried googling it. I simply need help compiling the opus-codec API (on Windows).
Once I have the library compiled, I'll build a wrapper for it's API.
While my searches have indeed found opus wrappers targeting my current project's language (c#), I can't find an up-to-date one. I don't know if it matters, but I need it for it's VoIP capabilities.
Sorry for my stupidity in the matter.
[UPDATE]
After compiling with Visual Studio 2010: Ultimate, I have a .lib library file. I need a .dll. I don't know what I'm doing. Help?
In a C project there is going to be some way to drive a build of all the object files, libraries, etc. Basically the same thing as maven build in Java, just with different tools. You will have to have the right tools if you don't.
On unix systems it's usually Makefile driven, running command line programs that compile and link the program or library that is being built. In GUI environments like XCode or Visual Studio, there are ways to run the build directly from the UI.
Looking at the source tree, there's a directory with a number of Visual Studio 2010 projects in it - https://git.xiph.org/?p=opus.git;a=tree;f=win32/VS2010
If you're using Visual Studio, loading that up and trying a build to see if it still works is where I'd start. Or perhaps have a look at Any way to do Visual Studio "project only" build from command line? or other questions that reference msbuild.

How to deploy a Win32 API application as an executable

How can I deploy my Win32 application as an EXE application so that others (who don't have VC++ installed) can use it?
I am using VC++ 2010 on Windows 7.
If you switch to "Release" mode when you compile your finished program (rather than "Debug", which you use for debugging it during development), you should get an executable that will run on a computer without Visual Studio installed.
However, that executable will still require the appropriate version of the C runtime library to be installed. For example, if you developed it in Visual C++ 2010, you will need version 10 of the CRT installed. This is a freely redistributable library, downloadable here.
So, you have several options for deployment:
Manual Deployment
Give people the bare executable file, and include the installer for the redistributable in another folder on the installation media. If they copy the executable to disk and cannot run it because they get an error message, they should install the CRT libraries from the included redistributable installer. Then the executable will run just fine.
This works great if you have relatively a computer-savvy audience, or you're deploying to a fixed range of machines (like across a school or corporation). But it doesn't work so well for general deployment to customers.
In fact, you don't even need the installer. You can just place the CRT DLLs in the same folder as your executable and it will run just fine. This is how I test apps I'm developing on clean VMs. It works like a charm. There's no need to run the CRT installer at all. You'll find these required libraries as part of your Visual Studio installation:
<Program Files folder>\Microsoft Visual Studio 10.0\VC\redist\x86
Automated Deployment
Create a setup program that automatically installs your application along with any dependencies it requires, including the CRT redistributable. This is what you see most commercial applications doing. I recommend it for anything but the most trivial of apps.
Full versions of Visual Studio 2010 (i.e., not Express versions) can create a Setup Project that you can customize as needed to work as an installer for your application. But this is no longer the recommended way to create an installer, and this functionality has been removed from the latest version of Visual Studio, 2012.
So I recommend using something else, even if you have an older version of VS where the Setup Project is available. No point in wasting time creating something you'll just have to update later. My personal favorite choices for creating setup programs are WiX and Inno Setup. Both are free, and extensive documentation is available online.
Creating simple setups that don't have to do very much is really quite straightforward—this is likely the case for you, as all you need to do is install the CRT redistributable if it is not already there. I'd be willing to bet money you can find a walkthrough or example online for how to do this in either WiX or Inno Setup.
If you need to do more complicated stuff, both of these setup packages support it. They are extensively customizable and very powerful, it just takes more work to get it all going.
Static Linking
If you absolutely need to be able to distribute a bare executable that is guaranteed to simply work when double-clicked, you will need to switch your project to statically link in the required runtime libraries. This means that all of the CRT code is actually embedded by the linker directly into your executable, and means that you don't have to redistribute the CRT libraries separately.
The disadvantage of this approach is that the only way to benefit from improvements, bug fixes, and security patches released for the CRT is to recompile and redistribute your application. If you dynamically link (the default), your app will automatically benefit from enhancements to the installed version of the CRT libraries. Microsoft strongly recommends against static linking.
To switch between these modes in Visual Studio, follow these steps:
Right-click on your project in the Solution Explorer and select "Properties".
Ensure that the "Release" configuration is selected in the drop-down box at the top of the dialog.
Expand the "C/C++" item in the TreeView, and select "Code Generation".
Change the setting of the "Runtime Library" option to "Multi-threaded (/MT)".
A further description on what these cryptic compiler switches mean and which ones you should use when is given in my answer here.
Final Note: The "Debug" versions of the CRT libraries are not redistributable, but that doesn't matter because you should always distribute the "Release" build of your app anyway, never the "Debug" build.
In general, the odds are pretty good your EXE file will run on any version of Windows you built it on or higher.
All bets off, for example, if you built using Visual Studio 2012 Professional on Windows 7, and you try to run it on Windows 95. But otherwise, you're probably safe :)
The best way to test if you have any dependencies is to install and run on a "clean machine".
The best way to get (and reuse) a "clean machine" is with a VM.
I recommend VMWare. But Virtual Box and Windows Virtual PC are also viable choices.
As far as an installer, I'd strongly encourage you to look at InnoSetup
I hope that helps!
Make sure you build in release mode. As Floris Velleman said, you're using unneeded libraries for standalone executable.
For more information, you can check Compiler Options (MSDN).

visual studio 2010 release can't find dll

I've build a project with opencv, when I share my .exe on other pc they can't find some dlls, this happens in release and debug mode, I searched on the web and I know I must configure the properties of the project, I tried configure MFC but with all the configuration the problem persist.
thank you!
Are they SystemFramework libraries? Or are they libraries that your app specifically uses, ones that you have imported into the project?
If they are your custom/imported libraries, make sure you copy them to output, and send them with the exe. The point of an installer is to bring the client your executable will of the the files it need to reference, compiled into a single file.
It seems the runtime librarie of opencv are missing. I'm not familiar with opencv, but VS provides a way to find all dependencies: http://msdn.microsoft.com/en-us/library/vstudio/dd293568.aspx. You can build an installation package for your application.
Another way to find all dependencies is using depends.exe, details are in:http://msdn.microsoft.com/en-us/library/ms235265.aspx

How to publish my C++ application?

I made a game in C++, using Visual Studio 2010. For this game I'm using OpenGL and GLUT, IrrKlang, ODE and fltk (so a buch of libs and dlls). I also have a folder of sounds and some text files. All paths are relative and my application works well from the environment (both debug and release modes). The exe files won't work though.
How do I make an installer kit for my application? My solution includes two projects.
I've done this before with XNA projects, but now it's completely different. Please do not refer me to msdn because I've been there.
Thanks!
First you should decide on a setup authoring tool. Here is a list that can get you started: http://en.wikipedia.org/wiki/List_of_installation_software
After that, try creating an installer with that tool. Most of them have tutorials and documentation which may help. If you encounter problems, you can then ask more specific questions.

Importing WinSCP source files into Microsoft Visual Studio 2008?

I am pretty new to programming. I would like to download an open source project and build it in my Microsoft Visual Studio 2008. In fact, I tried to import and build the application WinSCP:
https://sourceforge.net/projects/winscp/
But I didn’t work. Please can somebody help me and tell me which files do I have to download (from sourceforge) and how to import these into Microsoft Visual Studio in order to build the application. Thank you a lot. David
WinSCP seems to be written in Borland C++ Builder or whatever it's called today. It's not a standard C++ program and wouldn't compile in any other compiler because it uses special features only present in BCB. (It uses Delphi-style components, VCL and thus the __property keyword.)
Unfortunately, a lot of Open Source projects have very poor support for Microsoft's development tools. One project that comes to mind as being not too big and having workable MSVC project files is FreeType2, but that's a library and not an application, which probably makes it not very interesting for toying around with.
In support forum of winscp, they say, that you can't compile this project in Visual Studio.
Winscp appears to be a CPP project using a makefile instead of a sln file. VS uses SLN and *proj files to control builds and such. A good way to start would be to open VS, create a new console project (and solution) and go through some tutorials online.
If you really want to just see how a large project works in VS, grab something like IronRuby or IronPython or even something like the Witty twitter client.
In the general case, it is not possible to pour the C++ sources of a program into Visual Studio and expect it to work. C++ programming environments are far too different between operating systems for that. If you have a open-source program which builds and runs fine on Linux (for example), it may need several weeks (or months) or programming effort to make it run on Windows.

Resources