开发者

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 turn开发者_高级运维s 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜