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.
Related
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.
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 ?
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.
I've compiled QT and copied it over to a network drive. But now I've got the problem that the platform plugins are only found on my computer because it seems that those path got compiled into the binaries. How can I make QT to look into another directory? I thought that the system variable QTDIR should work but it gets ignored completely. Also tried to add a bunch of directories to the PATH variable which didn't work either.
I need a solution which is useable without changing the code itself.
If you need to load Qt plugins from different path you must use environment variable QT_PLUGIN_PATH.
Qt also looks for the plugins in directories relative to the path where the executable is installed. You need to properly deploy your applications, and you definitely don't need to copy the entirety of Qt anywhere. You also don't need to set QT_PLUGIN_PATH - it's a workaround for a simple problem.
Ideally, as part of your application's release build process you should be creating an installer, and that installer would then handle putting all the plugins into the application's installation folder.
I follow all the step which need to configure opencv with visual studio 2010 but when i run my application i am getting the following error
You should add OpenCV bin folder to your environmental path..
Assuming the mentioned DLL is present on your hard drive, VisualStudio doesn't know where to find it.
Try adjusting the working directory or the path, under Project Settings > Configuration Properties > Debug.
If you are sure that the file in question is actually present on your computer, then it's just that the file is in the wrong spot, or your directory is messed up. It is possible that said file is corrupted, or was not installed properly. Make sure that your directory is in order, make sure you have the file, and make sure it's in the place it's supposed to be. If the problem continues, try uninstalling and re installing your compiler. If that still doesn't work, you may be having a serious problem with your computer.
You are running into OpenCV dll issues, similar to here where I gave the following answer already.
Three ways to fix dll-related issues about OpenCV, also works for other dll related issues.
copy the required dlls into the same folder with your application. This is a little better because it kind of prepares you for when you'll need to deploy your application on systems that don't have OpenCV installed (for then don't forget to build the release version of your application).
add the dll path to Debugging Environment: Project –> Properties –> Configuration Properties –> Debugging –> Environment –> add dlls' paths here. The syntax is NAME=VALUE and macros can be used (for example, $(OutDir).
For example, to prepend C:\Windows\Temp to the PATH: PATH=C:\WINDOWS\Temp;%PATH%
Similarly, to append $(SolutionDir)\DLLS to the PATH: PATH=%PATH%;$(SolutionDir)\DLLS
add the dll path to Environment Variables (be careful that the path in there are separated by ;)
EDIT: Among the three methods, the first two will only work for this project (local) and the last one works for all projects in your PC (global).