<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Compiling from the command line with gcc</title>
		<link>http://www.allegro.cc/forums/view/615093</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 20 Feb 2015 04:51:19 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What library should I pass as argument to <b>gcc</b> in addition to <b>-lallegro</b> in order to compile code in which appears a call to <span class="source-code"> <a href="http://www.allegro.cc/manual/al_show_native_message_box"><span class="a">al_show_native_message_box</span></a></span>?</p><p>Thanks <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (caomatto)</author>
		<pubDate>Thu, 19 Feb 2015 04:14:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You should have a lib file with the name dialog in it. Link to that one by using -lNAME where NAME is allegro_dialog.dll or something similar and the entire filename is liballegro_dialog.dll.a, or also libNAME.a. Or else link to the monolith. What distribution of allegro are you using? Or did you compile from source? The names vary slightly.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 19 Feb 2015 05:05:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I am on Ubuntu and I compiled from source, downloading the source through <b>git</b>.  I typed <b>gcc test.c -o test -lallegro -lallegro_dialog</b> and it worked.  Thanks! <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>At page 1 of <tt>allegro-5.0.10-manual.pdf</tt>, there is a list of the addons: </p><ul><li><p>allegro_main</p></li><li><p>allegro_image</p></li><li><p>allegro_primitives</p></li><li><p>allegro_color</p></li><li><p>allegro_font</p></li><li><p>allegro_ttf</p></li><li><p>allegro_audio</p></li><li><p>allegro_acodec</p></li><li><p>allegro_memfile</p></li><li><p>allegro_physfs</p></li><li><p>allegro_native_dialog</p></li></ul><p>

Why can all those libraries be linked in <b>gcc</b> by passing their name prefixed with <b>-l</b>, except for the last one?</p><p>For example the arguments <b>-lallegro_image</b>, <b>-lallegro_primitives</b>, <b>-lallegro_memfile</b> work, but the argument <b>-lallegro_native_dialog</b> doesn&#39;t and should be replaced by <b>-lallegro_dialog</b>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (caomatto)</author>
		<pubDate>Thu, 19 Feb 2015 18:00:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It is probably due to a naming convention confusion that occurred when they first added that addon and maybe nobody has bothered to fix it... I&#39;m not sure. <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /> In general, there&#39;s no magic here. You can locate the Allegro libraries (shared objects) in your file system, named exactly as they are on your command line, except for having a lib prefix and so suffix per standard, as well as various symlinks with various degrees of version number (usually).</p><pre class="terminal">sudo updatedb
locate liballegro | grep /lib</pre><p>

Rather than manually specifying linker flags, you should probably be using pkg-config to manage your linker flags for you.</p><pre class="terminal">gcc -o test -Wall $(pkg-config --cflags allegro_5 allegro-dialog_5) \
        test.c $(pkg-config --libs allegro_5 allegro-dialog_5)</pre><p>

It&#39;s kind of surprising that you managed to compile and link without specifying custom header and library directories. Either you modified the install prefix or maybe Ubuntu includes /usr/local by default to make things easier (and potentially less secure)...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Fri, 20 Feb 2015 04:51:19 +0000</pubDate>
	</item>
</rss>
