LoadLibrary failed. Error 127 - c++

I have an executable C++ project (VS2008) which calls dll (VS2008). And that DLL also calls DLL (VS2012) which uses OpenCV. On the computer where Visual Studio is it works fine. But I have "LoadLibrary failed. Error 127" while trying to execute the same pack of files on another computer.
I've already checked the files with Dependency Walker and added all the DLLs missing.

The problem was in the version of the OpenCV dll's. Used vc10 instead of vc11 and it worked.

Related

Trouble generating a deployable binary for a C++ wxwidgets project using Visual Studio

I’m having trouble generating a deployable binary for a C++ wxwidgets project using Visual Studio. After the build completes, the exe that is generated does not seem to get installed in any other Windows machine.
Visual studio 2019 is used to create GUI library with openCV included in it. I’m trying to create a standalone executable .exe to run it in any other Windows computer without installing visual studio or opencv in it.
Earlier, while opening the executable file in other computer, it gave error that dll’s are missing for openCV and wxwidgets. So, I have copied the required dll’s from the directories of openCV and wxwidgets bin folder. Now, when I try to execute the exe file, it shows the following error. Kindly help me to resolve this issue.
Applications built with the C/C++ runtimes dynamically linked (/MD[d]) require the appropriate x86 (32-bit) or x64 (64-bit) VC++ redistributables on the target machine. They can be installed from The latest supported Visual C++ downloads, or they can be included alongside the application for local deployment.
Also, be sure to only send out non-debug (Configuration = Release) builds.
MSVCP140D.dll
VCRUNTIME140D.dll
VCRUNTIME140_1D.dll
ucrtbased.dll
The 'D' suffix in the names of those missing DLLs stands for "Debug". Those are the debug C/C++ runtime DLLs, which are used by the Configuration = Debug builds, and are installed as part of the Visual Studio setup. They are to be used during development, but not otherwise deployed, per Determining Which DLLs to Redistribute:
Debug versions of applications and the various Visual C++ debug DLLs are not redistributable.
It also seems that you are using DLL build of wxWidgets and you build OpenCV as DLL.
If you yourself does not create a DLL and your software is one self contained binary ou will be better off using static linking wxWidgets and OpenCV.
And on top of what #dxiv, not everything in MS CRT can be used statically linked. That's why it is strongly recommended to install MS CRT by creating an installer, which should take care of all those dependencies.
HTH.
Thank you.

Unable to load dll libglorycolx2010.dll. The application has failed to start because its side by side configuration is incorrect. HRESULT: 0x800736B1

I am using a third party dll, libglorycolx2010.dll in my C++ project. When i try to run the project i get the above error.
Many sources online suggested that i install Microsoft Visual C++ Distributable package which i have done. The problem is, i am not sure which dependencies are required by the dll. In that case i installed all versions Microsoft Visual C++ Distributable packages (2005,2008,2010,2012) X86 bit, but the problem still persists. I am using DllImport to load the library and i am using Visual Studio 2012 Professional.
I also tried to register the dll using regsvr32 but still got the same exact error. Kindly someone help.
Use dumpbin command using visual studio command prompt to analyze the libglorycolx2010.dll. This will analyze the dll and display all the dependencies of the dll.
Go to system32 folder and search for all the dependencies that were displayed using the dumpbin command.
There is a likelihood some may be missing. Go to https://www.dll-files.com/ and search for the missing dll and download it, then copy it to system32 folder.
Try running the Project again.
Usually when I get this error, it means that I am trying to load a 32bit dll into a 64bit application, or a 64bit dll into a 32bit application.

How to fix error MSVCP120D.dll in Visual Studio 2015?

Hello I have downloaded and unzipped OpenCV-2.4.10.exe on my PC. Then created a new Win32 Console application project in VS 2015, set all the Paths in Project properties, set the environmental variables in Win8.1. When I'm trying to start the program in debugging mode I get the "The program can't start because MSVCP120D.dll is missing from your computer. Try reinstalling the program to fix this problem".
Then, I downloaded the Visual C++ redistributable for Visual Studio 2015 But the problem still remains. What should I do to use OpenCV in VS 2015?
OpenCV-2.4.10.exe comes with runtime binary dlls built to work with runtimes from vc10 (vs2010), vc11 (vs2012) and vc12 (vs2013).
These DLL files use MSVCP100.dll, MSVCP110.dll and MSVCP120.dll respectively, and if you have installed Visual Studio 2015 you should find them in your System32 (or SysWOW64) directory.
The MSVCP120D.dll error appears when your application tries to load the DEBUG version of the DLL binaries. You do not have MSVCP120D.dll unless you have Visual Studio 2013 installed on your system. To solve this problem, use the Release runtime instead of the Debug runtime.
All you need to do is exclude the DEBUG lib files from your project. This means including only the lib files without the suffix 'd'. (ie. include opencv_core2410.lib instead of opencv_core2410d.lib)
HTH
Extras:
You don't really need to load the Debug binaries, unless you need to debug openCV's source code. If you do, there's still a way. Download the openCV source code, use CMake to create a VS2015 project. You can then build your own dll binaries using the latest runtime from VS2015.
VS2015 uses vc14 while OpenCV2.4.10 doesn't come with pre-built binaries associated with vc14. This answer should help you to understand. Accordingly you should choose the right folder (vc14) for Linker>General>Additional Library Directories in project properties.
You can use cmake to build binaries using VS2015 or you can download a later version of OpenCV which has prebuilt binaries for vc14.

“The procedure entry point… could not be located” in the wrong DLL

I have created a DLL from Haskell code and I am calling this DLL from C++. My application works fine when I run it in Debug mode in Visual Studio 2010, but when I make a Release build and install it, I get the error
The procedure entry point GetDataChunk could not be located in the dynamic link library AdvancedMath.dll.
AdvancedMath.dll is my Haskell-based DLL. The weird thing is that the function GetDataChunk isn’t in that DLL—it’s in another DLL I link against, and nothing about that DLL or my application’s use of it changed when I added the Haskell DLL.
This error message seems to be saying that Windows is confused about which functions live in which DLLs. What could be going wrong here?
This looks to be a bug in Visual Studio 2010 Release mode (Haskell dll functions are not imported by exe built in Release mode hence Haskell dll is not loaded, in Debug imports are present and it works fine).
The same exe project built in Release mode using Visual Studio 2013 Update 4 and Visual Studio 2015 RC works fine.
Have you tried using .def file to define exports? https://msdn.microsoft.com/en-us/library/d91k01sh.aspx
After you create it, you must edit project properties Linker->Input->Module definition file

msvcr120d Is missing

I've been trying to compile on opencv program in C++ and I have randomly started getting this error message.
Using dependency walker I can see that this dll is needed by my program but is net being found.
I used Xsearch to search my computer for the dll but it is not found.
I have downloaded a copies of the dlls (both the release and debgu versions) and placed them in the same directory as my application.
I have also tried placing them in the C:\windows\System32 folder and using regsvr32 to register them.
Regsvr32 gives me another error message
I've also tried installing the redistributable packages for visual studio with no effect.
I seem to be running out of options :(
Doh
Figured it out
Was using msvcr120 instead of msvcp120