<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>mingw — Orx: Portable Game Engine</title>
      <link>https://forum.orx-project.org/index.php?p=/</link>
      <pubDate>Thu, 21 May 2026 17:22:09 +0000</pubDate>
          <description>mingw — Orx: Portable Game Engine</description>
    <language>en</language>
    <atom:link href="https://forum.orx-project.org/index.php?p=/discussions/tagged/mingw/feed.rss" rel="self" type="application/rss+xml"/>
    <item>
        <title>Compiling static or dynamic libraries in my game with mingw.</title>
        <link>https://forum.orx-project.org/index.php?p=/discussion/9016/compiling-static-or-dynamic-libraries-in-my-game-with-mingw</link>
        <pubDate>Thu, 01 Nov 2018 02:40:13 +0000</pubDate>
        <category>Help request</category>
        <dc:creator>sausage</dc:creator>
        <guid isPermaLink="false">9016@/index.php?p=/discussions</guid>
        <description><![CDATA[<p>I am wanting to learn a little more about compiling libraries into my game, some dynamically, some statically. And what I should expect along the way. I am hoping to document this for others compiling games using mingw (with gmake, codelite or clock::blocks).</p>

<p><strong>The issue</strong></p>

<p>When running my mingw compiled game, I receive the following errors when removing the path to my C:\MinGW-6.3.0\bin folder:</p>

<p><img src="http://orx-project.org/forum/uploads/editor/h4/7di4ytst14z7.png" alt="" title="" /></p>

<p>The program can't start because libstdc++6.dll is missing from your computer. Try reinstalling the program to fix this problem.</p>

<p><img src="http://orx-project.org/forum/uploads/editor/jr/cc5bpn889uxm.png" alt="" title="" /></p>

<p>The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem.</p>

<p><strong>My game structure</strong></p>

<p>My current game file structure is laid out something like this:</p>

<p>bin/<br />
    Output.exe &lt;- release build of the game<br />
    orx.dll &lt;= game framework dll</p>

<p>data/ &lt;- folder containing my assets<br />
src/ &lt;- containing around 10 .cpp and .h files.</p>

<p><strong>The ideal situation</strong></p>

<p>I would like to end up with:</p>

<ul>
<li>Data folder with my assets</li>
<li>Bin folder with:

<ul>
<li>my game .exe which has libstdc++6.dll and libgcc_s_dw2-1.dll statically linked.</li>
<li>The orx.dll which the .exe dynamically links to.</li>
</ul></li>
</ul>

<p>There's a number of references to this issue via various searches. The easiest fix is to simply copy libstdc++6.dll and libgcc_s_dw2-1.dll next to my .exe, but I wish to have the configuration above, having them statically compiled in.</p>

<p><strong>Experimenting and Learning</strong></p>

<p>First I took note the the sizes of the various libraries:</p>

<p>libgcc_s_dw2-1.dll  917K<br />
libstdc++-6.dll 1474K<br />
orx.dll 6703K</p>

<p>My executable, which dynamically links to orx.dll is: 513K</p>

<p>I have read that by adding -static to the linker options in my makefile (ALL_LDFLAGS) should statically compile in the libraries to my exe. So by doing so and compiling again, the second compile is slightly larger. The two exe's are:</p>

<p>Outpost-dynamic.exe 513K<br />
Outpost-static.exe 748K</p>

<p>The difference between the static and dynamic version is 235K. None of my libraries above are around that size, so I am not sure what compiled in statically.</p>

<p>If I test either of these .exe's they will fail looking for the libstdc++6.dll and libgcc_s_dw2-1.dll again.</p>

<p>The static version prompts for the files once, the dynamic one prompts for them twice.</p>

<p>I then inspected both exe's in Dependency Walker. I am not 100% of how to interpret the results, but I'll have a go, please tell me if I am wrong. Firstly, the regular dynamic version:</p>

<p><img src="http://orx-project.org/forum/uploads/editor/d1/raqt3sgqpxmh.png" alt="" title="" /></p>

<p>Interesting that it shows orx.dll because (while not compiled into the exe) it is a dependency, and therefore will be loaded during execution. Also, the exe know it needs libstdc++6.dll and libgcc_s_dw2-1.dll, but because I took the path away, the exe will not work.</p>

<p>Next I try the static one:</p>

<p><img src="http://orx-project.org/forum/uploads/editor/yk/n2dfi4vp503z.png" alt="" title="" /></p>

<p>Even more interesting. libstdc++6.dll and libgcc_s_dw2-1.dll no longer show. Probably because they are statically compiled in? But I can't find any trace of them. But the exe is not looking for them anymore. (That's a lie, because the orx.dll if expanded is still looking for them).</p>

<p>The next thing to try is to add the entire static compile linker flags: -static -static-libgcc  -static-libstdc++</p>

<p>However, after cleaning and compiling again, the result is an exe that is 748K again. So perhaps those flags are in the wrong place.</p>

<p>I have also tried combinations of -Wl flags to set some things dynamic and some static, but I might not have gotten it right.</p>

<p><strong>Conclusion</strong></p>

<p>I really want to understand what I should expect by trying to compile things statically. Should the files have compiled into my exe? Did it actually succeed? Did I miss some other required step? Why did they file sizes differ? Was there some success in doing this?</p>
]]>
        </description>
    </item>
   <language>en</language>
   </channel>
</rss>
