0

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?

genpfault
  • 51,148
  • 11
  • 85
  • 139
ChrisMacDee
  • 111
  • 1
  • 10
  • possible duplicate of [C++ executable - MSVCR100.dll not found error](http://stackoverflow.com/questions/6976940/c-executable-msvcr100-dll-not-found-error) – Nemanja Trifunovic Sep 19 '11 at 18:17
  • 1
    Nitpick: It's not knots, but noughts or possibly naughts. – molbdnilo Sep 20 '11 at 09:32
  • haha thanks, updated! :P @NemanjaTrifunovic tried changing the build mode to MT but i just got a bunch of linking errors with the msvcrt.lib file :/ – ChrisMacDee Sep 20 '11 at 20:26

4 Answers4

3

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.

Chad
  • 18,706
  • 4
  • 46
  • 63
  • Actually, with Visual C++ 2010, xcopy deployment of the runtime library is supposed to work again. – Ben Voigt Sep 19 '11 at 18:23
  • Installing the x86 version fixed the problems on my friends computer and forgot to add a couple of extra dll files with the standard sdl.dll and sdl_image.dll. Thanks – ChrisMacDee Sep 23 '11 at 14:07
2

This is probably the most helpful tool for identifying which libraries you forgot to ship with your program:

It was originally included with the Windows SDK, but that website has updated versions.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
1

install microsoft vc++ redist on target machine, have had trouble just trying to copy msvcr100.dll/msvcp100.dll too.

Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
Illizit
  • 11
  • 1
0

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.

robert
  • 3,484
  • 3
  • 29
  • 38