<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Static compiling MinGW</title>
		<link>http://www.allegro.cc/forums/view/616500</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 01 Oct 2016 01:57:58 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello!</p><p>I have been trying to compile an Allegro program using the static library in MinGW. I failed to do it manually in the command line so I tried with Code::Blocks using this guide: <a href="https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5">https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5</a>.<br />It&#39;s a bit outdated though, and the library names doesn&#39;t match, and there are more libraries and at least one library missing in the latest Allegro 5.</p><p>Some questions:</p><p>1) Are you supposed to just copy the &quot;lib&quot; and &quot;include&quot; directories to MinGW&#39;s corresponding directories? How can you update Allegro if you just mix in files like that?</p><p>2) Are you supposed to pick x86 or x64 depending on the platform you compile on or is it that you pick what the target platform is for your program?</p><p>3) So to avoid mixing the Allegro files with the MinGW files I went with the Code::Blocks guide. Here is what I did so far:</p><p>*Installed MinGW with version 5.3.0 of gcc/g++.<br />*Installed Code::Blocks v16.01 separately.<br />*Downloaded Allegro v5.2.1.1 and dependecies v1.4.0 (took I while until I figured out that I needed these too, they don&#39;t appear on the main site).<br />*I followed to guide to link all the libraries and includes from Allegro, dependecies and those neeeded MinGW libraries into a Code::Blocks project.<br />*I also added extra flags -static and -lpthread as explained in this post: <a href="https://www.allegro.cc/forums/thread/616089">https://www.allegro.cc/forums/thread/616089</a>.<br />*I took a known working program and tried to compile it.</p><p>I get two undefined references to &quot;__ms_vsnprintf&quot; errors.<br />I have no idea what I did wrong. I have gotten this to work before on an older Allegro 5 on another computer some years ago.</p><p>Thanks for any help.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ponkutsu)</author>
		<pubDate>Mon, 26 Sep 2016 12:34:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/616500/1025220#target">Ponkutsu</a> said:</div><div class="quote"><p>
I have been trying to compile an Allegro program using the static library in MinGW. I failed to do it manually in the command line so I tried with Code::Blocks using this guide: <a href="https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5">https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5</a>.<br />It&#39;s a bit outdated though, and the library names doesn&#39;t match, and there are more libraries and at least one library missing in the latest Allegro 5.
</p></div></div><p>
That guide is pretty outdated....</p><div class="quote_container"><div class="title">Ponkutsu said:</div><div class="quote"><p>
1) Are you supposed to just copy the &quot;lib&quot; and &quot;include&quot; directories to MinGW&#39;s corresponding directories? How can you update Allegro if you just mix in files like that?
</p></div></div><p>
You can do it that way, but it&#39;s not a good way to do it, as you noted yourself. What you want to do is keep Allegro separate, and then set your compiler and linker search paths to include the &quot;include&quot; and &quot;lib&quot; folder of the allegro distribution respectively, using -I INCLUDE_DIR and -L LIB_DIR.</p><p>Ex.
</p><div class="source-code snippet"><div class="inner"><pre>mingw32-g<span class="k3">+</span><span class="k3">+</span> <span class="k3">-</span>Wall <span class="k3">-</span>O0 <span class="k3">-</span>o game.exe <span class="k3">-</span>I c:\LIBS\Allegro5211_MinGW5302_Rel3\include <span class="k3">-</span>L c:\LIBS\Allegro5211_MinGW5302_Rel3\lib <span class="k3">-</span>lallegro_monolith-static <span class="k3">-</span><span class="k1">static</span> <span class="k3">-</span>ldumb <span class="k3">-</span>lFLAC <span class="k3">-</span>lvorbisfile <span class="k3">-</span>lvorbis <span class="k3">-</span>lfreetype <span class="k3">-</span>logg <span class="k3">-</span>lpng16 <span class="k3">-</span>lzlibstatic <span class="k3">-</span>lgdiplus <span class="k3">-</span>luuid <span class="k3">-</span>lkernel32 <span class="k3">-</span>lwinmm <span class="k3">-</span>lpsapi <span class="k3">-</span>lopengl32 <span class="k3">-</span>lglu32 <span class="k3">-</span>luser32 <span class="k3">-</span>lcomdlg32 <span class="k3">-</span>lgdi32 <span class="k3">-</span>lshell32 <span class="k3">-</span>lole32 <span class="k3">-</span>ladvapi32 <span class="k3">-</span>lws2_32 <span class="k3">-</span>lshlwapi <span class="k3">-</span>static-libstdc<span class="k3">+</span><span class="k3">+</span> <span class="k3">-</span>static-libgcc
</pre></div></div><p>

</p><div class="quote_container"><div class="title">Ponkutsu said:</div><div class="quote"><p>
2) Are you supposed to pick x86 or x64 depending on the platform you compile on or is it that you pick what the target platform is for your program?
</p></div></div><p>
x86 is for 32 bit and x64 is for 64 bit. It depends on your compiler. MinGW by itself is only for x86.</p><div class="quote_container"><div class="title">Ponkutsu said:</div><div class="quote"><p>
3) So to avoid mixing the Allegro files with the MinGW files I went with the Code::Blocks guide. Here is what I did so far:</p><p>*Installed MinGW with version 5.3.0 of gcc/g++.<br />*Installed Code::Blocks v16.01 separately.<br />*Downloaded Allegro v5.2.1.1 and dependecies v1.4.0 (took I while until I figured out that I needed these too, they don&#39;t appear on the main site).<br />*I followed to guide to link all the libraries and includes from Allegro, dependecies and those neeeded MinGW libraries into a Code::Blocks project.<br />*I also added extra flags -static and -lpthread as explained in this post: <a href="https://www.allegro.cc/forums/thread/616089">https://www.allegro.cc/forums/thread/616089</a>.<br />*I took a known working program and tried to compile it.</p><p>I get two undefined references to &quot;__ms_vsnprintf&quot; errors.<br />I have no idea what I did wrong. I have gotten this to work before on an older Allegro 5 on another computer some years ago.
</p></div></div><p>
Installing MinGW 5.3.0 is correct.<br />Installing the stand alone CodeBlocks 16.01 is correct.<br />Here&#39;s where you may have messed up. I don&#39;t know if the binaries SiegeLord provides for MSYS2 MinGW64 work with standalone MinGW. I&#39;m guessing they don&#39;t.</p><p>I provide binaries for the stand alone MinGW 5.3.0-2 that include all the dependencies with it. These should work for you. Download the latest version from here :<br /><a href="https://sourceforge.net/projects/unofficialallegro5distribution/files/?source=navbar">Unofficial Allegro 5 distribution files</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 26 Sep 2016 22:08:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="https://www.allegro.cc/forums/thread/616500">Edgar Reynaldo</a> said:</div><div class="quote"><p>
Ponkutsu said:</p><p>I have been trying to compile an Allegro program using the static library in MinGW. I failed to do it manually in the command line so I tried with Code::Blocks using this guide: <a href="https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5">https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5</a>.<br />It&#39;s a bit outdated though, and the library names doesn&#39;t match, and there are more libraries and at least one library missing in the latest Allegro 5.</p><p>That guide is pretty outdated....<br />Ponkutsu said:</p><p>1) Are you supposed to just copy the &quot;lib&quot; and &quot;include&quot; directories to MinGW&#39;s corresponding directories? How can you update Allegro if you just mix in files like that?</p><p>You can do it that way, but it&#39;s not a good way to do it, as you noted yourself. What you want to do is keep Allegro separate, and then set your compiler and linker search paths to include the &quot;include&quot; and &quot;lib&quot; folder of the allegro distribution respectively, using -I INCLUDE_DIR and -L LIB_DIR.</p><p>Ex.</p><p>mingw32-g++ -Wall -O0 -o game.exe -I c:\LIBS\Allegro5211_MinGW5302_Rel3\include -L c:\LIBS\Allegro5211_MinGW5302_Rel3\lib -lallegro_monolith-static -static -ldumb -lFLAC -lvorbisfile -lvorbis -lfreetype -logg -lpng16 -lzlibstatic -lgdiplus -luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32 -lshlwapi -static-libstdc++ -static-libgcc
</p></div></div><p>
Thanks, this works! I wonder why some guides insist on copying the library to the MinGW directories though.</p><div class="quote_container"><div class="title"><a href="https://www.allegro.cc/forums/thread/616500">Edgar Reynaldo</a> said:</div><div class="quote"><p>
Ponkutsu said:</p><p>2) Are you supposed to pick x86 or x64 depending on the platform you compile on or is it that you pick what the target platform is for your program?</p><p>x86 is for 32 bit and x64 is for 64 bit. It depends on your compiler. MinGW by itself is only for x86.
</p></div></div><p>
I see, official MinGW is only for 32-bit. I don&#39;t think I will make 64-bit programs anyway. And 32-bit is better for compatibility.</p><div class="quote_container"><div class="title"><a href="https://www.allegro.cc/forums/thread/616500">Edgar Reynaldo</a> said:</div><div class="quote"><p>
Ponkutsu said:</p><p>3) So to avoid mixing the Allegro files with the MinGW files I went with the Code::Blocks guide. Here is what I did so far:</p><p>*Installed MinGW with version 5.3.0 of gcc/g++.<br />*Installed Code::Blocks v16.01 separately.<br />*Downloaded Allegro v5.2.1.1 and dependecies v1.4.0 (took I while until I figured out that I needed these too, they don&#39;t appear on the main site).<br />*I followed to guide to link all the libraries and includes from Allegro, dependecies and those neeeded MinGW libraries into a Code::Blocks project.<br />*I also added extra flags -static and -lpthread as explained in this post: <a href="https://www.allegro.cc/forums/thread/616089">https://www.allegro.cc/forums/thread/616089</a>.<br />*I took a known working program and tried to compile it.</p><p>I get two undefined references to &quot;__ms_vsnprintf&quot; errors.<br />I have no idea what I did wrong. I have gotten this to work before on an older Allegro 5 on another computer some years ago.</p><p>Installing MinGW 5.3.0 is correct.<br />Installing the stand alone CodeBlocks 16.01 is correct.<br />Here&#39;s where you may have messed up. I don&#39;t know if the binaries SiegeLord provides for MSYS2 MinGW64 work with standalone MinGW. I&#39;m guessing they don&#39;t.</p><p>I provide binaries for the stand alone MinGW 5.3.0-2 that include all the dependencies with it. These should work for you. Download the latest version from here :<br />Unofficial Allegro 5 distribution files [sourceforge.net]
</p></div></div><p>
Thanks a lot! This helped, now I can compile in the command line as well as Code::Blocks.<br />I downloaded the file &quot;Allegro5211_MinGW5302_Rel3.tar.7z&quot; and it worked perfectly with official MinGW.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ponkutsu)</author>
		<pubDate>Thu, 29 Sep 2016 17:34:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/616500/1025279#target">Ponkutsu</a> said:</div><div class="quote"><p>Thanks, this works! I wonder why some guides insist on copying the library to the MinGW directories though.</p></div></div><p>
These are standard locations, so every makefile written with the assumption that the library is in default location will work.<br />Otherwise, every time you pick sources from someone else, you have to add &quot;-I&quot; and &quot;-L&quot; arguments in their build instructions. And the makefiles / cmake scripts that you build work only on your current machine.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Audric)</author>
		<pubDate>Thu, 29 Sep 2016 18:26:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>And if you try to compile allegro with allegro already installed? Well, have fun. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 29 Sep 2016 22:28:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I see, it really is troublesome to compile someone else&#39;s code like this. Still Allegro binaries doesn&#39;t come with an installer or anything so it&#39;s a pain to uninstall manually if you need to try another build. You might as well keep a batch file for compiling Allegro projects. Or a project template in an IDE that links everything. But if a project relies on a complicated makefile it might not work so well I guess.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ponkutsu)</author>
		<pubDate>Sat, 01 Oct 2016 01:51:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Most projects worth their salt that use allegro will allow you to specify an install directory where allegro is located. If they don&#39;t, they&#39;re not all that useful. It&#39;s as simple as setting a few search directories in a codeblocks project, or setting an environment variable in cmake.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 01 Oct 2016 01:57:58 +0000</pubDate>
	</item>
</rss>
