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

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

Related

How to include the ncurses.h library in C++ Visual Studio Linux Project when targeting Ubuntu on Windows?

I am trying to create a C++ console based program that will utilize the ncurses.h library. I am using Visual Studio 2017 targeting the WSL subsystem (Ubuntu).
Within ubuntu, running on my WSL, I have installed the ncurses libraries successfully.
I have created a new Project in VS. After unsuccessfully being able to get the #include to work correctly, I followed instructions on Stack to and added 'ncurses' in the Library Dependencies line under Linker / Input in the VS project properties. This enabled the application to compile the first time, and I was able to see in the Console Output that the library file was found and linked. However, VS still gives squiggly lines (errors) under all of the function names associated with the ncurses library. Also, the code does not work as expected, as the terminal appears to freeze. After running the code 2x, it appears now that the code will not build at all and I receive a strange error message that says the "program to debug does not exist on the remote system"
Can anyone please help? I've been using Visual Studio as my IDE with the WSL for school and would like to continue doing so. Future projects will be dependent on the ncurses library.
thank you for your help

VS2015 : The application was unable to start correctly (0xc000007b)

I wrote a code on Visual studio 2015 for a windows 10 PC. The application is mainly focused on UDP communication and I use the boost libraries.
It works perfectly but when I move the folder of the code to Windows 7 I receive the error "The application was unable to start correctly (0xc000007b)". I tried also in Windows 8.1 and after rebuilding the libraries it works.
What I noticed is that when I receive the error it does not load the .dll that in the other versions it loads.
May it be a problem with the boost?
Have you ever experienced it?
0xc000007b is error when you try to use x64 dlls in x32 application or other way around, so you probably copied wrong dlls. Rebuild fixed this, as it prepared new dlls.
win7_64 visual studio 2015, 0xc000007b
When I was programming C++ code in the visual studio 2015, it threw the error:0x000007b, and I have tried three kinds of solutions;
1.Installing Direct X
2.Installing VC C++ 2015 libraries
3.Making sure the DLL is consistent with the OS(and I think this is relevant to my problem)
ANd my solution will show below:
enter image description here
and I changed the [[[Debug]]] into [[[X64]]], then, it works, I believe that because some dlls are not consistent with the platform, so if I changed the Debug platform, We will get the correct result.The prerequisite:must having installed all dlls under the X64 system.

Release not working on different PC

I am not so experienced with C++ and MS Visual Studio. I am currently having issue with releasing .exe and trying to run the program on different PC. In the program I'm using additional library (magick++). I've configured the Runtime Library in Visual Studio 2015 to Multi-threaded (/MT). I suppose, that with this configuration the .exe file should be running on different PCs, but when I try to run it, message with "CORE_RL_Magick++. dll is missing on this computer appears. Any idea, what might be wrong?
My second question is, if I would like to make a release with dynamic library /MD, how can I get the library to run it on different PC? Or do I have to install the library first (I mean if I have to install Imagemagick to the computer or is there some way I can get the nescessary library from the build in Visual Studio).
Thanks for every information.
Do you have CORE_RL_Magick++. dll in the path (including the directory that your exe program is running) somewhere on the computer that is failing.
The /MD and /MT commands effect what runtime is used, not what other libraries the program is dependant on.
So with /MT, it will compile a static version of the visual c libs into the exe, but if linked against the magic dll, it will still need that CORE_RL_Magick++. dll in order to run.
I think /MD is a better choice, for smaller size.
If you want to run program on other PC, you may need to install Visual Studio Redistributable (could be downloaded on Microsoft website) on the PC first.
Agree with Martin Zhai. I had this problem when attempting to run my program on another machine after upgrading to 2015. The DLL I wanted to use would not be found despite being local. Installing Visual C++ Redistributable for Visual Studio 2015 fixed this.

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.

Compile (?) issue. Visual studio c++ 2008

There's an app that I use on an XP netbook for tuning a car. It was working just fine. Then I needed to make a simple modification (output to STDOUT instead of to file) so I got the source from the author.
My netbook doesn't have the space for a compiler. I have Visual Studio C++ 2008 on a Windows 7 desktop. I made the adjustments, compiled and tested on the desktop and it worked perfecty. So then I copied the executable to the netbook and it won't run
"This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem"
Original (precompiled) exe works fine. To rule out my changes, I compiled the source without the mods and it still didn't work. The executable works fine on the 7 machine as well as another Win Vista machine I tried.
So its obviously something with the XP machine and the way the executable is compiled. I really have no idea how this stuff works so I don't know what to try.
Couple of ideas:
As Keith said above this is DLL/manifest issue.
Get Visual Studio 2008 redistributable (for matching application platform) and install it on the netbook.
If this does not help: Use Dependency Walker to find out what other DLLs you are missing.
Its because a dependency / DLL compiled into your application doesn't exist on the platform you are running on.
Open windows event viewer and view the application log. There will be an entry for the error and the name of the DLL which is missing. Copy / Install that DLL on your target platform.
I would guess your vc runtime has changed with visual studio 2008 and you need to copy the latest version to your target platform. If you dont know where to get the dependency DLL, post the name here and we can see what we can do about it.
You can check your project settings and make sure to use a statically linked runtime instead of a DLL.
Project Settings, C/C++ -> Code Generation. Make sure you're using a runtime library that isn't a DLL. (So Multi-threaded Debug instead of Multi-threaded Debug DLL for example).