Using SDL_image in Visual studio 2010, with error "application was unable to start correctly 0xc000007b" - c++

I'm trying to do the SDL tutorial here http://lazyfoo.net/SDL_tutorials/lesson03/windows/msvsnet2010e/index.php
I did everything they asked me to do, everything built correctly, but when I tried to run the executable, I always get the error: "application was unable to start correctly 0xc000007b"
I'm using Win7 on a mac (bootcamp), with visual stdio 2010 professional

If you have placed SDL.dll under C:\Windows\system32 or \SysWOW64 like the tutorial says, doing this may work:
Download SDL.dll (Runtime Libraries > Win32, not the 64-bit version*) and place it in the project folder where the .exe file is located.
E.g. if the project location is C:\myproject, place the SDL.dll at C:\myproject\Debug.
Then you can remove SDL.dll from \system32 or \SysWOW64. This can also prevent version conflicts, like the tutorial suggests.
*) I'm on 64-bit Windows 7, and the 64-bit version of SDL.dll didn't work for me.

Ensure that the SDL.dll (or SDL2.dll) that the .exe loads (from its own directory, or from a Windows system directory) matches the SDL.lib that it was linked with. Examples:
The application was unable to start correctly (0xc000007b)
Dev IL linking and compiling error (0xc000007b)
This applies to any version of Visual Studio, 32 or 64 bit, and any of Lazyfoo's tutorials.

Also what helped me - ensure you are using x86 .dll for the x86 application and not x64 dll files for the x86 app and vice versa.

Ran into this issue in VS2019 when running in debug mode, had to add path to my debugging environment.
Project properties->debugging settings

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.

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.

How to build an SDL C++ program for distribution?

I've been using C++ and SDL to create a program. When I build this program it works on my machine, but when I try to run it on another computer it says that all sorts of DLLs are required, and after including all the explicitly asked for DLLs the error becomes
"The application was unable to start to start correctly (0xc000007b)."
What I'm asking is: how do I build this program in such a way that it will work on other computers. I'm using Visual Studio Express 2013 for Windows Desktop and SDL 2.0.3.
I'd be happy to answer any questions.
EDIT: Both computers were running 64 bit Windows 7.
EDIT 2: I included all the DLLs Dependency Walker suggested, but still got the "The application was unable to start to start correctly (0xc000007b)" error on the other machine.
First include the SDL2.dll with the exe and other libs, then download the visual c++ redistributal 2013 and install it on that windows 7 machine, also make sure the build that you built wasn't a debug build

Visual Studio 2010 C++ SDL game works on the computer it was compiled on, but not on any other

I have coded a game of noughts and crosses in C++ using SDL and Visual Studio 2010. I have built it in Release and it works no problem if I run the .exe on the computer I compiled it on (Windows 7 64bit Home Premium).
I tried to run it on my laptop (Windows 7 x86 Home premium) and it opens up an SDL window and immediately closes. I found it was crashing when loading a particular file so added a console output to the initialisation code and turns out it is this file it can't find:
if((menuSurface = Surface::Load("gfx/menu.png")) == NULL){
std::cout << "menu Did not load.";
system("pause");
return false;
}
Peculiarly this is the second file loaded and the original computer can find it fine.
Problem above has been solved! I simply forgot to add the extra .dll files that came with sdl_image such as zlib1.dll, libpng12-0.dll etc... Second problem still persists.
Additionally on my friends computer when I run it, it comes up with this error
TestWin32.exe – System Error
The program can’t start because MSVCR100.dll is missing from your
*computer. Try reinstalling the program to fix this problem.*
I included the MSVCR100.dll file in the same folder as the .exe (along with the SDl.dll and SDL_image.dll) and still no joy. The file is present in his SysWOW64 folder but the program isn't picking it up. Can anyone see what may be causing this?
The first problem is likely an issue with the resource not being at the correct location.
The second problem is that with the new Microsoft C runtime DLLs you cannot just include it, you need to deploy the appropriate redistributable for Visual Studio 2010.
You can find that (x86) here. There is also a separate x64 version if you need it.
This is probably the most helpful tool for identifying which libraries you forgot to ship with your program:
Dependency Walker
It was originally included with the Windows SDK, but that website has updated versions.
install microsoft vc++ redist on target machine, have had trouble just trying to copy msvcr100.dll/msvcp100.dll too.
Find out what DLLs your executable is dynamically loading, both on your development system as well as on the other systems.
I suspect that some DLL is being loaded that shouldn't be, e.g. a library's DLL in a wrong version.

After in VS2010 include other library, app fail on start with error 0xC000007b

I have a problem, downloaded curl developemnt package but if i
add in my visual studio .lib file form this program fail with
0xC000007b on startup.
I trying download all complete source in this i can download simple vs6
project but without errors i convert it to visual studio 2010, i compile
this solution normally, libcurl with curl.exe working good but if i try
add to my project fresh compiled static libcurl library or libcurl dynamic
library i have this problem and i don't have ideas to debug it.
Anyone can help me?
That's STATUS_INVALID_IMAGE_FORMAT, Windows isn't happy about the DLL it needs to load. That's almost always caused by trying to load a 32-bit DLL in a 64-bit program. Or a 64-bit in a 32-bit program. If you converted this VB6 code to VB.NET then you probably need to force it to run in 32-bit mode. Project + Properties, Compile tab, scroll down, Advanced Compile Options, Target CPU = x86.
Install Microsoft Visual C++ 2010 Redistributable Package (x64) or (x86) depending on architecture of your computer.
It worked for me.