SDL Program doesn't run on certain computers

Hi,

I’d tried to run a program of mine on a friend’s computer and it wouldn’t even start.
It has worked (inside and out of VC++ 2008 Express Edition) on my computer running XP, Vista and Windows 7.
The confusing thing is, that it also worked on a different friend’s computer, who incidently has VC++ (not sure if that is relevent, but I have my suspicions).

I have two questions

  1. Does anyone know what might be going on here?
  2. I suspect it might be a linking problem so I would like to compile my program as Multi-threaded (/MT), rather than Multi-threaded Debug DLL (/MDd).
    However when I try this I get a lot of errors relating to linking and redefinitions and all sorts. Does anyone know if SDL programs can even be compiled as /MT?

This:
http://wiki.libsdl.org/moin.cgi/FAQWindows#When_using_Visual_C.2B-.2B-_I_get_link_errors_relating_to_MSVCRT.LIB_or_LIBC
seems to suggest not.

Thanks for your help.

Hi,

I’d tried to run a program of mine on a friend’s computer and it wouldn’t even start.
It has worked (inside and out of VC++ 2008 Express Edition) on my computer running XP, Vista and Windows 7.
The confusing thing is, that it also worked on a different friend’s computer, who incidently has VC++ (not sure if that is relevent, but I have my suspicions).

I have two questions

  1. Does anyone know what might be going on here?
  2. I suspect it might be a linking problem so I would like to compile my program as Multi-threaded (/MT), rather than Multi-threaded Debug DLL (/MDd).
    However when I try this I get a lot of errors relating to linking and redefinitions and all sorts. Does anyone know if SDL programs can even be compiled as /MT?

This:
http://wiki.libsdl.org/moin.cgi/FAQWindows#When_using_Visual_C.2B-.2B-_I_get_link_errors_relating_to_MSVCRT.LIB_or_LIBC
seems to suggest not.

Er, doesn’t this suggest they must be??

For some libraries, notably C and C++ standard libraries, all DLLs and your
application must link to the SAME library. This is because these DLLs
implement archaic libraries with bad design, particularly, they’re
non-reentrant because there are some global variables in them,
particularly static buffers for some C functions, and I/O buffers
for C and C++ standard input/output stuff. In addition, duplicate
RTTI in C++ can cause exceptions to malfunction.

OpenGL (at least the older versions of it) is also a badly designed library
for the same reason: it isn’t reentrant.

Therefore you’re probably right its a linking problem. Linux and OSX
aren’t much better (I have linking problems on both).

Generally speaking IF you did a complete static link of the program
and all libraries including C libraries etc and you got a symbol duplication,
then you have a problem, and that problem may not show up with dynamic
linkage until run time, and then it may show up as weird behaviour.

I recommend cursing loudly and swearing at all those people that
failed first year computer science, who continue to use global
variables (except where they’re really required: signal handling,
and even that is due to bad OS design :slight_smile:

Then try using your platform’s library dependency display tool to try to
figure out the transitive closure of library dependencies and see if there
are any obvious cases where different versions of the same library are used.
In particular if you move a program from one machine to another it may
have incompatible DLLs.

BTW: MS “assemblies” were design to fix this problem.On 20/02/2011, at 2:34 AM, rps wrote:


john skaller
@john_skaller

Hi John,

Thanks for the reply.

The way I read that line in the FAQ is that SDL must be compiled as Multi-Threaded DLL (/MD). Which would mean it can’t be just Multi-Threaded (/MT).
However I also can’t compile it Multi-Threaded DLL without the debug option, so maybe there is more at work.

Plus I only heard about these terms today, and you seem to know a lot more about it.

I’ll try to take a look at the library dependencies. But in the meantime I’ll post this build warning I just noticed (this is from /MDd mode, when it actually builds).

LINK : warning LNK4076: invalid incremental status file ‘~Debug~.ilk’; linking nonincrementally
MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib ‘msvcrt.lib’ conflicts with use of other libs; use /NODEFAULTLIB:library

I tried adding the "/NODEFAULTLIB:msvcrt.lib option, but it didn’t seem to achieve much.

Thanks.