Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Building a program and using it elsewhere  (Read 1866 times)

0 Members and 1 Guest are viewing this topic.

MitjaHD

  • Newbie
  • *
  • Posts: 6
    • View Profile
Building a program and using it elsewhere
« on: November 29, 2018, 08:29:24 pm »
I'm using code::blocks and I'm trying to make a program that I could show in school, however I don't have experience with such simple steps so I don't know how to save it to make it possible to open on other computers that don't have sfml installed (if that's possible?). In some projects I can see the "Release" folder, but in some I can only see Debug folder. I tried putting together the exe from release folder and sfml dlls and then I got an error that I'm missing some gcc dlls, so I copied dlls from MingW folder, but it still didn't work (in school).
At home it works of course, but I think school has different version of codeblocks as computers are reset when shut down. What would be the best way to do it?

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Building a program and using it elsewhere
« Reply #1 on: November 30, 2018, 04:06:10 am »
You need to find and include the right dlls your exe needs: https://stackoverflow.com/questions/475148/how-do-i-find-out-which-dlls-an-executable-will-load

You need to be careful to not include wrong dll (same name but older version or 32 bit instead of 64 or vice versa). You can use a tool like Everything to find those files easier on your Windows machine: http://www.voidtools.com/support/everything/

Of course don't include any dlls from like C:/Windows/ or C:/Windows/System32 or similar, like 'user32.dll' or 'kernel32.dll', those are 'system' ones with special purpose and exes that only use them (like busybox-w32, exes made via FPC, etc.) are said to have 'no dependencies' or 'linked statically' or 'self-contained'.

If you loaded anything via LoadLibrary (dlopen on Linux, it's how programs load arbitrary dlls at runtime for plugins, extra native libraries, etc.) then you need to include those too (obviously they can't be listed by just looking at the exe like the tools in that SO answer do since they are loaded at runtime, non-deterministically, often all dlls from some folder are loaded, etc.), but that's a separate thing and you almost definitely didn't use those.
« Last Edit: November 30, 2018, 04:08:13 am by FRex »
Back to C++ gamedev with SFML in May 2023

Lightbody

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Building a program and using it elsewhere
« Reply #2 on: November 30, 2018, 10:18:14 pm »
I'm using one of these superb home golf simulators and I'm trying to make a program that I could show in school, however I don't have experience with such simple steps so I don't know how to save it to make it possible to open on other computers that don't have sfml installed (if that's possible?). In some projects I can see the "Release" folder, but in some I can only see Debug folder. I tried putting together the exe from release folder and sfml dlls and then I got an error that I'm missing some gcc dlls, so I copied dlls from MingW folder, but it still didn't work (in school).
At home it works of course, but I think school has different version of codeblocks as computers are reset when shut down. What would be the best way to do it?

How do you make absolutely sure you didn't include dlls that don't belong there, FRex? Is there a simple method for this?
« Last Edit: July 27, 2023, 01:37:06 pm by Lightbody »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Building a program and using it elsewhere
« Reply #3 on: November 30, 2018, 10:45:00 pm »
Which way? Not including anything from C:/Windows is straight forward.

I use VS2017 which links against msvcp140.dll and vcruntime140.dll in Release so I just grab those from latest MSVC version subdirectory that also matches my build (x86 or x64). I also then test on a Virtual Box Windows 10 VM that I keep only up to date with Windows Update and install nothing on ever that it runs correctly and after that I consider it 'working'.

I don't know what you'll need for your exact GCC that you have installed with that Code::Blocks. Did you try using some tool to find what dlls your exe needs or did you note the names from error message on another PC and then try searching for that dll or looking it up online (this isn't SFML specific), maybe there's just one such dll or two at most (one for 32 and 64 bit each) so there is no choice to make at all?

Back to C++ gamedev with SFML in May 2023

 

anything