Thread: external libraries and distribution

  1. #1
    Registered User Stonehambey's Avatar
    Join Date
    Jan 2008
    Location
    Kent, UK
    Posts
    118

    external libraries and distribution

    Is there a checklist of things I must bundle with a program which uses external libraries to ensure that it will work on other computers when downloaded from my site?

    I tried running a simple SDL app I made on another computer, but all I got was a dos window flash up and then disappear immediately. I included all the .dll files in the zip, but I can't think what else I would need to include.

    here's the zip for anyone interested.

    link

    Any help is, as usual, greatly appreciated,

    Regards,

    Stonehambey

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    run it from the console.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Are you catching errors/exceptions and logging them?

  4. #4
    Registered User Stonehambey's Avatar
    Join Date
    Jan 2008
    Location
    Kent, UK
    Posts
    118
    Quote Originally Posted by robwhit View Post
    run it from the console.
    I'm not sure I follow, exactly

    Are you catching errors/exceptions and logging them?
    If something doesn't load or fails to initialize it returns a number other than 0, much like the lazy foo way. However I quickly learnt that always returning 1 didn't really help me locate errors, so the program returns different numbers depending on which part has failed. When testing it in the IDE (code blocks, in my case) it just tells me which number was returned when I run the program, making the problem easy to find. I'm unaware how to find out this information when not running it within the IDE. Forgive my ignorance if it should be obvious to me

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Create a logger object that logs information to a file.

  6. #6
    Hmm...? gin's Avatar
    Join Date
    Jun 2008
    Location
    Glasgow, Scotland
    Posts
    51
    Quote Originally Posted by Stonehambey View Post
    I'm not sure I follow, exactly
    Well, he's saying run the program using command prompt (cmd.exe). Just go to Run -> cmd.exe. Then just go to the path where your program is located then type in the program name and see what it spits out.

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Short summary of (DOS/Windows) console commands:
    • cd: change directory. Change to the directory your executable is located in. Use \ to separate folders. For example: cd "\Documents and Settings\User"
    • program: type the name of a program to run it, with or without the .exe extension.
    • dir: list the files in the current directory. You can use something like dir *.exe to see what exe files are present.
    • exit: what do you think?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  8. #8
    Registered User Stonehambey's Avatar
    Join Date
    Jan 2008
    Location
    Kent, UK
    Posts
    118
    That's what I thought he might mean, what's the difference between running a program that way and just double clicking on the .exe?

    Anyway, I still get the same problem.

    As a point of interest. I can run the SDL programs from your site, dwks. However when I try to run them from another computer, I get exactly the same problem (window flashes open then closes immediately), despite all the correct .dll files being on the computer.

    Might this suggest that the problem is not specifically with my programs, but something more general? It seems that my computer, on which I've developed an SDL app, likes SDL apps just fine. But other computers don't seem to like them so much

  9. #9
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Quote Originally Posted by Stonehambey View Post
    That's what I thought he might mean, what's the difference between running a program that way and just double clicking on the .exe?

    Anyway, I still get the same problem.

    As a point of interest. I can run the SDL programs from your site, dwks. However when I try to run them from another computer, I get exactly the same problem (window flashes open then closes immediately), despite all the correct .dll files being on the computer.

    Might this suggest that the problem is not specifically with my programs, but something more general? It seems that my computer, on which I've developed an SDL app, likes SDL apps just fine. But other computers don't seem to like them so much
    That's exactly why we were suggesting that you run programs from the command prompt. When you do so, the window doesn't flash and disappear before you can read it; it stays open. That way, you can look at any error messages that might have been printed.

    By the way, anything my SDL applications print to the console window they also generally write to a log file, sailseas.log for Sail the Seas, xuni.log or test.log for xuni, and so on. For exactly the reason you've encountered.

    <shameless-plug>If you like my projects, you should look at the latest version of xuni, from here: xuni.sourceforge.net
    Plus you can use codeform to highlight large portions of code that you post on CBoard . . . </shameless-plug>

    As for SDL apps . . . well, you have to have the right DLLs. However, when you run a program that requires a DLL, and that DLL is not present, you'll get an error message in a dialog box saying which DLL is missing (I think -- it's been a while). So that's probably not the case.

    Is the system that your program does not work on a Vista one, by any chance? There might be some permissions issues with DLLs under Vista. I really have no idea.

    I thought DLLs could be in the current directory, but maybe they have to be in the system directory on Vista or under all Windows systems. Do you have SDL.DLL in, say, \windows\system32 or something?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  10. #10
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Or is this a versioning problem? What version of SDL was the program compiled with, and what is it running against?

  11. #11
    Registered User Stonehambey's Avatar
    Join Date
    Jan 2008
    Location
    Kent, UK
    Posts
    118
    I tried it on two computers, both XP. One had the .dll files in the windows/system32 folder, the other just in the same directory as the app. At first some of the dll's were missing, and it gave an error message like you said. After all the dll's were added, it stopped moaning.

    The console window doesn't print anything.

    I guess I'm not really helping myself if I'm not logging my errors properly. I thought maybe someone might have had a similar distribution problem and had a suggestion :P

    EDIT:

    Or is this a versioning problem? What version of SDL was the program compiled with, and what is it running against?
    It's the latest SDL, compiled on code::blocks on Windows Vista

  12. #12
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by Stonehambey View Post
    It's the latest SDL, compiled on code::blocks on Windows Vista
    Is the one you compiled with the same one on the target machine?

  13. #13
    Registered User Stonehambey's Avatar
    Join Date
    Jan 2008
    Location
    Kent, UK
    Posts
    118
    Quote Originally Posted by medievalelks View Post
    Is the one you compiled with the same one on the target machine?
    The versions of SDL are the same yes, in fact the .dll files were copied straight from my machine

  14. #14
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by Stonehambey View Post
    The versions of SDL are the same yes, in fact the .dll files were copied straight from my machine
    The only thing I can think of is that perhaps another, older version is in the path somewhere.

    Are there any other DLLs that your application depends on?

  15. #15
    Registered User Stonehambey's Avatar
    Join Date
    Jan 2008
    Location
    Kent, UK
    Posts
    118
    Not that I can think of.

    Here's the source of the program,

    http://stonehambey.com/source/KeyEvent.zip

    It's mostly just a lazy foo tutorial, but with a few small changes, so I honestly can't see where the problem would be. Perhaps something to do with the way the IDE builds the project?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Gamma distribution in C#?
    By dudeomanodude in forum C# Programming
    Replies: 2
    Last Post: 06-07-2008, 01:59 PM