How to manually register a 64 bit DLL with WiX - c++

I'm using WiX to install a 64 bit application. I've figured out how to make a 64 bit installer, but I'm having trouble figuring out how to register my DLLs I install so I don't get
"Program can't start because XXXX.dll is missing from your computer.
Try reinstalling the program to fix this problem"
errors.
I've tried using heat.exe to create the necessary RegistryValue tags, but it's not compatible with 64 bit DLLs. I compiled some of the DLLs in 32 bit (not all are available to me in 32 bit), but I still couldn't get heat.exe to work. Looking at this WiX help article it seems like I should be able to compose the RegistryValue tags manually, but I'm confused about what they should contain. I've been looking at the example here and it is much more complicated than the one in the WiX article.
What RegistryValue tags do I need to register a DLL with the OS so it can be found on the PATH?
EDIT: Additional context.
I'm trying to install an SDK and some sample source code. I'm putting the SDK (DLLs, .libs, and headers) in a folder in \Program Files, and I'm putting the sample source code in a folder on the desktop. I have the lib directories on %LIBPATH%,the include directories on %INCLUDE%, and the bin (DLL) directories on %PATH%.
Then I have a folder on the Desktop with a VS Solution for the sample code. In the solution I specify %LIBPATH% in the Additional Library Directories and %INCLUDE% in the Additional Include Directories fields of the VS Projects. That works fine and the solution will build. But when I try to run it I get the "DLL is missing from your computer" error. I'd like to figure out how to have the SDK DLLs be findable (whether that's on the %PATH% or not) so that the user can simply build and run the demo code without needing to copy the DLLs, and so that the same will be true of any other applications they build.
EDIT 2: I'm voting to close the question. It seems like registering a DLL using WiX is not relevant to my actual problem.

You're confusing two things here. "Registration" is a COM activity, but "XXXX.dll is missing" indicates an ordinary non-COM DLL.
Your reference to %PATH% also hints at a non-COM DLL, but %PATH% shouldn't be necessary. Instead, install your DLL alongside your executable.
In theory, there's also the Application Manifest, but Microsoft has made an utter mess of that. If you're writing any kind of ordinary application, I'd avoid them entirely.

Related

Missing libgcc_s_seh-1.dll starting the .exe on Windows

Intro
I have a CMake-based C++ project. Until now I build and ran the project via CLion. Everything worked fine until I tried to run the .exe-file directly (not via CLion).
Problem
When I navigate to the cmake build directory in order to start my program via the executable file, it fails with the following message in the popup: Cannot continue the code execution because libgcc_s so-1.dll was not found. Reinstalling the program may resolve the issue.
I have the following questions
If I interpret the error message correctly, then this dll is missing on my computer. So I ask myself, why does my program still work when I start it via the development environment (CLion), although the error message expressly states that the source code requires this dll?
Is it the fault of my application/source code that the error appears or rather the current state of my computer? If the former, how can I prevent this error from appearing for other users?
What is the best way to fix this error? It's obvious that I need to download this dll, but where is the best place to put it (which directory and environment variable to use on Window)?
Which source is trustworthy to download this dll? I don't want to download any malware under this dll-name.
Optional: What kind of library is that? What functionalities does it offer?
Additional information
I use CMake as my build tool, CLion as the IDE and MinGW as the compiler.
What I have did so far?
I made sure it still works through the IDE.
I found this dll does not exist in the MinGW installation folder.
I searched the web for more information. Unfortunately, there are only pages unknown to me that only offer the download of this dll. That doesn't satisfy me.
I found the cause of my problem: I had two MingGW installations on my machine. Once the installation that comes with CLion and a separate one. The latter did not have the required dll. However, CLion used its own installation, which in turn owns the DLL. So the solution was to remove the separate installation and include the path to the CLion installation's bin/ directory in the PATH environment variable.
This file is part of MinGW-w64 when using SEH as exception model (as opposed to Dwarf or SJLJ). You need to distribute the .dll files your .exe file(s) depend on in the same folder as the .exe file(s).
If you don't have that file, then you probably have been using libraries compiled with different versions of GCC/MinGW(-w64). I recommend building everything with the same compiler to ensure stable binaries.
Tools like Dependency Walker can help you figure out which .dll files your .exe file depends on.
Or use the command line tool copypedeps -r from https://github.com/brechtsanders/pedeps to copy the .exe files along with it's dependencies.

How to deploy Qt app compiled using MSCV so that it won't neet vc_redist installed?

Is there a way to deploy a Qt desktop application that is compiled using MSVC in such a way that it will be "portable" (just run exe from a folder, not install anything, not even install VC_redist)?
Of course, it is possible to use it if Microsoft Visual C++ Redistributable is installed on target computer, but is it possible to make it run without installing it (eg. by putting some dll from vcredist to application's folder)?
Just as you commented, you can use windeployqt to add Qt-related DLLs and resources. As for other required DLLs, you could use Dependencies to find them and MANUALLY copy them into your application folder, including MSVC DLLs.
PS: I know manually copy those DLLs is low efficient and fallible. This is why I ask Is there any way to search and copy all the DLL dependencies?, but I haven't found a tool smart enough to do this chore automatically. You might try those tools mentioned in the comments, like NDepend, though.
If you build/link your application statically, you will only have 1 .exe without DLL. The second way is to build your app with shared libraries and at runtime your app will search those DLL in PATH and in the current directory so you just need to put all your needed DLL in this folder. How do you manage your Qt library ?

OpenCV: Code Execution Cannot Proceed, DLLs Missing

I'm making a program using OpenCV and I need feature matching. I was previously using OpenCV3 but apparently getting SURF to work is a bit of a hassle so I switched to OpenCV2.4
I downloaded the pre-built libraries and I want to use them on Visual studio but I have a problem, when I run the program I get messages like this:
When I click ok I get more follow up messages complaining about other missing dlls. I tries re-installing but still get this error.
Here are my settings:
Under C/C++>General: Additional Include Directores:
C:\opencv2.4\opencv\build\include
Under Linker>General: Additional Library Directories:
C:\opencv2.4\opencv\build\x64\vc14\lib
C:\opencv2.4\opencv\build\x64\vc14\bin
Under Linker>Incput: Additional Dependencies:
opencv_calib3d2413.lib
opencv_contrib2413.lib
opencv_core2413.lib
opencv_features2d2413.lib
opencv_flann2413.lib
opencv_gpu2413.lib
opencv_highgui2413.lib
opencv_imgproc2413.lib
opencv_legacy2413.lib
opencv_ml2413.lib
opencv_nonfree2413.lib
opencv_objdetect2413.lib
opencv_ocl2413.lib
opencv_photo2413.lib
opencv_stitching2413.lib
opencv_superres2413.lib
opencv_ts2413.lib
opencv_video2413.lib
opencv_videostab2413.lib
I've also tried editing the Environment Variables under Path I've added the include\ bin\ and lib\ directories. I have absolutely no idea how to fix this problem. I know the dlls are there.
I copied and pasted the dlls from the bin\ directory into my solution directory and everything works fine now.
I'm not sure why adding the bin\ to the path didn't work but anyway here's the solution to that problem.
The execution program did not find the DLL.
Under "Linker>General: Additional Library Directories" it expect the path for .lib files, but the DLL are searched by the program during the executio, so in the current folder and in the PATH folders.
Put the Dll's into the execution folder or modify the PATH to add the DLL's folder (in this last case remember to restart Visual Studio).
Cheers

Running my GIS application using dev-c++ gives "gdal201.dll is missing"

I'm working on a GIS application in C++ using Dev-C++, and to start for now I'm using the code given in the tutorial in Link
I got it to compile without errors or warnings, but when I try to run it I get the error "The program can't start because gdal201.dll is missing from your computer. Try reinstalling the program to fix this problem."
I was looking at another question with the similar problem and tried to search this dll on internet, but couldn't find it anywhere, and somebody mentioned to ignore the error, but I don't know how to do that.
Can anybody help me on what to do here?
Thanks in advance.
You need the DLL file(s) to be present either in the same directory as the executable, or in your Path variable for the system to be able to find them. I personally prefer setting Path. You might consider either adding GDAL_DIR\bin to your permanent Path by editing system or user environment variables, or else create a small batch file on the desktop which adds the directory to Path then starts devenv.exe if you need to manage several incompatible development environments for different projects.
(This has several advantages in my experience over copying the DLL files to the same directory as the executable: It's easier to manage dependencies by including all the necessary directories, as opposed to manually tracking down all the recursive dependencies. It's also easier to manage updates of the DLLs if you can just update the GDAL installation directory, or update Path or the batch file to a newer GDAL installation directory, rather than having to track down all the places you've copied the DLLs to or having to manage post-build scripts to copy the DLLs every time.)
(Of course, when it comes time to create a self-contained installer, it's going to be easiest to copy the dependent DLLs to the installer image directory before building the installer. Then something like CMake's BundleUtilities module can help in tracking down what DLLs need to be included.)
Usually I copy private DLLs to the output folder of the project, i.e. the same folder as the executable. For a commercial application, you may want to install the DLL, let the OS handle the management of it and use the Assemblies Manifest to help the loader find it.

using curl in a win c++ application

I'm trying to use curl from within my windows c++ app but keep running into problems.
I'm using visual studio 2013 on a windows 8.1 machine.
Here's what I've done so far:
Cloned the repo from github
Built the libcurl project which produced three files: libcurl.dll, libcurl_imp.lib and libcurl_imp.exp
In my app project I added the curl include directory to the Additional Include Directories
Added the libcurl_imp.lib to the Additional Dependencies
Built my project
When I run my executable it says:
the program can't start because libcurl.dll is missing from your computer
I found a few things on it, but they solved it by adding the libcurl dll along with the exe, which isn't what I'm looking for as I want my executable to contain the libcurl so that it will work on machines without the need to have the dll.
Any ideas?
Thanks.
Edit
The 2nd step is done pretty much straight forward, I just right clicked on the project (libcurl) and chose buiild.
Due to the comments I've rebuilt it after changing the Configuration Type to Static library, so now it only produces one file: libcurl.dll which, as far as I know not a static library...
2nd edit
I wasted too much time on getting http functionality, and based on the info which I found thanks to a comment here (using libcurl without dll) I've decided to abandon this approach, and I found something which suits my needs perfectly and is simple to install/use: C++ REST SDK (codename "Casablanca")
Try to add libcurl.dll directory to PATH environment variable.