Statically linking dependencies using Visual Studio 2010 - visual-studio-2010

I have a VST plug-in which I have built on Windows using Visual Studio. It depends on two libraries (FFTW and Speex). I am able to link these to the project and it compiles - so far so good.
However, the problem is that I cannot get the plug-in to compile without requiring the .dll files at runtime - I have looked elsewhere on this site, found suggestions, and tried the following in Visual Studio:
Ensuring Configuration->Linker->Input->Additional Dependencies contain the .lib files I am looking to link
Ensuring Configuration->Linker->Additional Library Directories contain the directories of my .lib files
Making sure Configuration->C/C++->Code Generation->Runtime Library is set to MultiThreaded /MT
Yet, when I check using Dependency Walker (http://www.dependencywalker.com/), my plug-in still requires the .dll files.
The host with which I am looking to use the plug-in cannot load the VST if it has .dll dependencies (I have tried another host and it works fine, as long as the .dll files are in the same directory as the plug-in .dll file).
I would really like this plug-in to link statically to these libraries, can anyone help?
Thanks!
Adam
p.s. - as a check, I made a simple plug-in with no dependencies and compiled it and this loads in the host no problem

Related

How to build a portable program by visual studio

I am using visual studio 2010 under Win7-64bit to build an application with openCV. I finished development and build the release version without error. I also successfully run the program in debug mode. I then move the .exe file to other directory in the same computer. I run it in cmd.exe and I got error warning: Error opening file <../../modules/highgui/src/cap_ffmpeg_implhpp:537>
I guess there are some dependence with some libraries of openCV but I don't how to solve it. My final task is that I can use that .exe in another computer under Win7 directly. How to do it?
I found a similar question here. But I don't have .dll file built, so what should I do to solve this problem?
Building an OpenCV app with shared libs (DLLs) require the DLLs to be available (same folder or in lookup path) to the exe when it is run.
If you are using static linking then you don't need any of the OpenCV DLLs to be reachable. However, due to licensing issues, ffmpeg is linked dynamically even when the rest of the libs are linked statically, and thus, you need to have the ffmpeg DLL available for the exe. It is called something like opencv_ffmpeg*.dll.
Note that this is only needed if you are using highgui related functionality.

VS2010 VC++ Setup Project misses language dll

I have created a Setup Project in VS2010 for my VC++ project and I have it generating a setup file and it includes Primary Output, Content Files, Documentation files and Resource Sattelite DLLs from my VC++ project. My VC++ project is multilanguage and hence includes language DLL files in subdirectories. My issue is that the Setup Project does not include these language DLLs (nor their directories into which they must be placed).
I would have thought that these DLLs were included in the Project Output but they are not. :-/
I know I could add them manually by referencing the files directly, but that means including a absolute reference which I would rather not do. Also, a fixed reference means Release/Debug versions of the file are not handled (only one of them is use regardless of project setting).
Suggestions?
Edit: I have now tried Setup Project, InstallShield LE and WiX. None of them include the localization dll's into the setup project (only managed a working setup with Setup Project, but could see that the other installers did not include the required dll). I can't even fint any reference to this being a know bug and I have really tried hard to find a solution to this.
Found it over there:
C# Creating a setup for multi-language
It worked. I hope it is what you were searching for.

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

Finding required external symbols

I am currently facing a linking error on Visual Studios C++ 2010. I know exactly that I forgot to link some .lib files against the project and it turned out to be true.
However, the problem is my project depends on another project (that I did not do) that provides header files and .lib files that have different names. And I am having a hard finding the specific lib files.
In this case, how can I find the right .lib file for the symbols I am using?
Does this help? (dumpbin /SYMBOLS) https://stackoverflow.com/questions/1935183/tool-to-view-functions-exported-in-static-library

Adding libraries to Visual Studio problem

Can someone link me a good guide for using libraries in a c or c++ project?
Right now I'm trying to add OpenCV to a newly created project. I've added all the directories I can think of in "Project and Solutions -> VC++ Directories" and to make sure I've dragged and dropped all the .lib and .dll files into the project.
The project builds but when I run the simple "Hello, World program" it gives me this error message:
"cv.exe unable to locate component.
This application has failed to start because cv200.dll was not found. Re-installing the application may fix this problem."
How can I really add this cv200.dll? I've dragged&dropped it into the project..
Thanks!
You need to make sure that cv200.dll is in the DLL search path at run time. The easiest way to do this is to put it in the same directory as the built executable. Dragging and dropping a DLL or LIB file into your project has no effect.
MSDN has a good description of the full DLL search order when loading libraries at runtime.
By default during installation OpenCV create env. variable path \bin.
All dll assumed to be in that dir. However you are using OpenCV 2.0, and OpenCV 2.0 installation doesn't include lib and dll files for Visual Studio. You seems already built all dll's and lib's. If you installed OpenCV correctly just move all dll's into \bin (for example C:\Program Files\OpenCV\bin)
If for some reason you are missing some dll or libs here is instruction how to build them
http://mirror2image.wordpress.com/2009/10/20/switching-to-opencv-2-0-with-vs2005/

Resources