Thread: Problems running compiled .exe on other machines.

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    2

    Problems running compiled .exe on other machines.

    Hi C board,

    I have a rather weird problem..

    I have wrote this game in visual studio '08, and when i compile it, it runs perfect nothing there. It is a simple game with just one source file. The problems srufaces when I send the compiled .exe to anyone else who doesnt have visual studio '08 installed.

    I've had another guy compile my source code also with visual studio '08 and that .exe runs fine on any machine.

    So this get me thinking that there is proberly some compiler setting that I should change so it includes some .DLLs or something, but I dont know which or how for that matter.

    Any help is appreciated, thanks.
    -Troels Leth

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    If you build in release mode and set the linker option to "static linking", then there should be no need to distribute extra DLL's.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I disagree. Just have the other computer install the VS08 runtime and there's no need to install anything for any VS programs later ever (they will all run fine). Static linking will increase the size of the exe by a lot.

    Download: http://www.mediafire.com/download.php?zcsjzncbmm1
    Install. Never worry about not being able to run programs on the remote machine again.
    Remember to compile as release. Debug compiles will not run without VS installed.
    Last edited by Elysia; 05-08-2008 at 05:06 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by Elysia View Post
    I disagree. Just have the other computer install the VS08 runtime and there's no need to install anything for any VS programs later ever (they will all run fine). Static linking will increase the size of the exe by a lot.
    What is contained in that runtime and could it possibly overwrite dlls that could break existing programs on the client machine?

    I prefer one statically linked .exe. The business of distributing runtimes (whether it's VS, Java, Python, etc.) has to take versioning of said runtimes into account.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Not Visual Studio. I have never seen one broken program due to the runtime that I always install.
    Several statically linked executables will in the end override the size of the runtime only installed once.
    Static linking shouldn't exist IMHO.
    And runtime vendors should be more careful as to put the version in the filename too, to avoid overwriting other dlls.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Quote Originally Posted by Elysia View Post
    I disagree. Just have the other computer install the VS08 runtime and there's no need to install anything for any VS programs later ever (they will all run fine). Static linking will increase the size of the exe by a lot.

    Download: http://www.mediafire.com/download.php?zcsjzncbmm1
    Install. Never worry about not being able to run programs on the remote machine again.
    Remember to compile as release. Debug compiles will not run without VS installed.
    I s'pose I have to disagree with your disagreement User-friendly and update-friendly are far more valuable than saving a user who probably has at least several gigs to spare an extra few to a few hundred k.

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Well yeah, but here is where the silent VS runtime installer comes in handy
    You can easily make a setup program to download and install the runtime automatically if it isn't installed already!

    I really see no hassle at all. Download a setup program (very small). Installs the runtime if necessary. You're all set! Never more worry about that runtime. Download to your hearts contents!

    That's what I call user friendly. Static linking increases size dramatically and in the end, it will end up costing several MB on the target computer!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I am not going to call you an evil developer if I ever have a client use software you have written that does all this, but I myself prefer to eliminate the potential for something unforeseen to go wrong. Obviously its impossible to know what is unforeseen ahead of time, however, I have noticed many patterns of security exploits and/or faulty updates coming from Microsoft. That said, and for once I am not just bashing Microsoft, I have found that any project that uses multiple DLL's introduces new potential possibilities for problems with each new DLL. I.e. MyNetScan.DLL v2.3 seems to dislike MyNetPing.DLL v6.4 even though on 20 of the machines tested the update went smooth, for some odd reason the one that missed one obscure update needed a dreaded reinstallation.

    I guess at the end of the day it depends on the scope of the project as well as personal preference

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by master5001 View Post
    ...I have found that any project that uses multiple DLL's introduces new potential possibilities for problems with each new DLL. I.e. MyNetScan.DLL v2.3 seems to dislike MyNetPing.DLL v6.4 even though on 20 of the machines tested the update went smooth, for some odd reason the one that missed one obscure update needed a dreaded reinstallation.
    Yeah, that's pretty much a problem, isn't it?
    I always take note today to add the version of my dll to the filename to avoid potential problems!
    That mentioned, Microsoft does rename their dlls for each version of the runtime for each VS version, and the feature pack or service pack, so far as I know, is backwards compatible, so installing the latest runtime for VS shouldn't hurt at all.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    A problem that could so easily be remedied by MVFS. I think the argument is moot since I create all final builds using gcc anyway.

  11. #11
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by Elysia View Post
    I really see no hassle at all. Download a setup program (very small). Installs the runtime if necessary. You're all set! Never more worry about that runtime. Download to your hearts contents!
    And if an older version exists, will the installer regression test all of their existing applications? If a newer version exists, are you sure *your* application works with it?

    Static linking increases size dramatically and in the end, it will end up costing several MB on the target computer!
    In an age where drives are hundreds of GB, this is a non-issue.

  12. #12
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by medievalelks View Post
    And if an older version exists, will the installer regression test all of their existing applications? If a newer version exists, are you sure *your* application works with it?
    If they don't share the same name, then yes.
    Or if they do, and if they're backwards compatible, then yes.
    I don't dare imagine Microsoft would break backwards compability for VS runtime seeing as it must be installed, unless the applications are statically linked. I would imagine a nightmare for support if all of a sudden, all applications would break.

    In an age where drives are hundreds of GB, this is a non-issue.
    So you say, but there's also more factors to consider:
    I know people who even today are stuck with small hard drives and old computers.
    There are still many people who use dial up!
    Bigger hard drives today is no excuse for code bloat IMO (which is exactly what static linking is - code bloat!).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by Elysia View Post
    If they don't share the same name, then yes.
    Or if they do, and if they're backwards compatible, then yes.
    I don't dare imagine Microsoft would break backwards compability for VS runtime seeing as it must be installed, unless the applications are statically linked. I would imagine a nightmare for support if all of a sudden, all applications would break.


    So you say, but there's also more factors to consider:
    I know people who even today are stuck with small hard drives and old computers.
    There are still many people who use dial up!
    Bigger hard drives today is no excuse for code bloat IMO (which is exactly what static linking is - code bloat!).
    If a user installs a new version of my statically linked program, they get a new .exe installed over the old one. In your case, they get a new DLL installed next to the old one.

    Which installation is bloated?

  14. #14
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by medievalelks View Post
    If a user installs a new version of my statically linked program, they get a new .exe installed over the old one. In your case, they get a new DLL installed next to the old one.

    Which installation is bloated?
    No, that's the point - they don't.
    Runtime is installed once - only if required.
    Your static exe will keep adding unnecessary size each time you compile it.

    Dynamic route:
    1st time: Runtime (2 MB) + App (100 KB) = Total 2.1 MB
    2nd time: App (100 KB) = Total 2.2 MB
    3rd time: App (100 KB) = Total 2.3 MB
    4th time: App (100 KB) = Total 2.4 MB
    5th time: App (100 KB) = Total 2.5 MB
    6th time: App (100 KB) = Total 2.6 MB
    ...
    100th time: App (100) = 12 MB (100 * 0.1 + 2)

    Static route:
    1st time: App (500 KB) = Total 0.5 MB
    2nd time: App (500 KB) = Total 1 MB
    3rd time: App (500 KB) = Total 1.5 MB
    4th time: App (500 KB) = Total 2 MB
    5th time: App (500 KB) = Total 2.5 MB
    6th time: App (500 KB) = Total 3 MB
    ...
    100th time: App (500 KB) = Total 50 MB (0.5 * 100)

    Of course, this is just a small program. The bigger it is, the bigger the static size. The static size will just grow exponentially from there.
    Last edited by Elysia; 05-08-2008 at 06:12 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #15
    Banned
    Join Date
    Nov 2007
    Posts
    678
    i agree with Elysia, shared libs/dynamic libs save space.
    i just wish they had a more sane (may be a standard) way of dealing with changes, that, may affect old and new applications, after that, they are a win-win solution!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Switching Machines .... creating problems
    By SkinneyEd in forum C++ Programming
    Replies: 1
    Last Post: 10-12-2005, 02:37 PM
  2. Some Socket Problems...?
    By Tal0n in forum Linux Programming
    Replies: 1
    Last Post: 04-01-2004, 05:31 AM
  3. .exe problems
    By ZakkWylde969 in forum C Programming
    Replies: 7
    Last Post: 06-17-2003, 06:09 PM
  4. Help- Problems running outside of compiler
    By Derek5272 in forum C++ Programming
    Replies: 17
    Last Post: 05-07-2003, 08:19 AM
  5. Running Into Two Problems...Help Needed
    By Halo in forum C Programming
    Replies: 5
    Last Post: 04-18-2002, 08:14 AM