<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>learning allegro using a book, is this code flawed in the book or is it my comp</title>
		<link>http://www.allegro.cc/forums/view/588644</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 25 Nov 2006 09:58:29 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi, i am learning to code with  c&amp; allegro, here is a script in the book it ask me to compile. I have already set the linker commands in my compiler &quot;using dev c++&quot; <br />This is code straight out of the book. I want to continue reading the book but i need to make sure my compiler is correctly set up. </p><p>#include &lt;stdlib.h&gt;<br />#include &lt;allegro.h&gt;</p><p>int main(){<br />    allegro_init();<br />    printf(&quot;Allegro version = %s\n&quot;, allegro_id);<br />    printf(&quot;\n Press any key...\n&quot;);<br />    system(&quot;pause&quot;);<br />    allegro_exit();<br />    return 0;<br />}<br />END_OF_MAIN()</p><p>errors </p><p>make.exe -f &quot;C:\Documents and Settings\computer\Desktop\gameprogramming\ch2\Makefile.win&quot; all<br />g++.exe -c GetInfo/getinfo.cpp -o GetInfo/getinfo.o -I&quot;C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2/backward&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2/mingw32&quot;  -I&quot;C:/Dev-Cpp/include/c++/3.4.2&quot;  -I&quot;C:/Dev-Cpp/include&quot;    -O3</p><p>GetInfo/getinfo.cpp: In function `int _mangled_main()&#39;:<br />GetInfo/getinfo.cpp:6: error: `printf&#39; undeclared (first use this function)<br />GetInfo/getinfo.cpp:6: error: (Each undeclared identifier is reported only once for each function it appears in.)</p><p>make.exe: *** [GetInfo/getinfo.o] Error 1</p><p>Execution terminated
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ansimega)</author>
		<pubDate>Tue, 21 Nov 2006 00:30:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Add: #include &lt;stdio.h&gt; to the top of your file.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 21 Nov 2006 00:40:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>add:<br /><span class="source-code"><span class="p">#include &lt;stdio.h&gt;</span></span><br />underneath the other two #include lines.</p><p>EDIT: MOOOOOOSSSSEEEE!!!! <img src="http://www.allegro.cc/forums/smileys/angry.gif" alt="&gt;:(" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Tue, 21 Nov 2006 00:40:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You need to add the following line at the start:</p><p><span class="source-code"><span class="p">#include &lt;stdio.h&gt;</span></span></p><p>Edit: Darn, beaten by a blue friendly monster!</p><p>Edit2: And a moose!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 21 Nov 2006 00:40:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m pretty sure you need to include stdio.h to get printf...</p><p>Also, system(&quot;pause&quot;) isn&#39;t very nice...</p><p>EDIT: Wow, for responses on the same minute.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Johan Peitz)</author>
		<pubDate>Tue, 21 Nov 2006 00:40:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, Wow. 4 messages at the same time.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 21 Nov 2006 00:41:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Who wants to play &quot;Guess the book title?&quot;
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 21 Nov 2006 00:42:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
If the book example is going to use Allegro why not use rest() or readkey()?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Tue, 21 Nov 2006 00:44:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If the book example is going to use Allegro why not use rest() or readkey()?
</p></div></div><p>

Well, if the author is silly enough to forget to include <tt>stdio.h</tt>...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 21 Nov 2006 00:49:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks guys, the book is called Game Programming All In One by Jonathan S. Harbour, he claimed he tested the code on every type of operating system.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ansimega)</author>
		<pubDate>Tue, 21 Nov 2006 00:55:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
okay. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Tue, 21 Nov 2006 01:06:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>He also <i>claims</i> to be a writer and a programmer.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 21 Nov 2006 01:27:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>By the way... I don&#39;t know if the book tells you to use C or C++, but that code will compile fine if you made it a &quot;C&quot; file instead of a &quot;C++&quot; file.</p><p>The &quot;++&quot; is for extra errors!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Tue, 21 Nov 2006 01:27:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
is this code flawed in the book
</p></div></div><p>
If it&#39;s the book I think it is, then yes, it is.</p><p>EDIT
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
the book is called Game Programming All In One
</p></div></div><p>
That&#39;s the one!</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
he claimed he tested the code on every type of operating system.
</p></div></div><p>
He blatently didn&#39;t. He also claimed &quot;Allegro 4.2 is not backward compatible&quot;, which is false.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Tue, 21 Nov 2006 02:11:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Evert said:</div><div class="quote"><p>
If it&#39;s the book I think it is
</p></div></div><p>

</p><div class="quote_container"><div class="title">ansimega said:</div><div class="quote"><p>
the book is called Game Programming All In One by Jonathan S. Harbour
</p></div></div><p>

Edit: aha, I see you read back through the thread. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 21 Nov 2006 02:14:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In GPAIO edition 2, here&#39;s that same bit of code:</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;conio.h&gt;</span>
<span class="p">#include &lt;stdlib.h&gt;</span>
<span class="p">#include "allegro.h"</span>

<span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="k2">{</span>
   <a href="http://www.allegro.cc/manual/allegro_init" target="_blank"><span class="a">allegro_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
   <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Allegro version = %s\n"</span>, <a href="http://www.allegro.cc/manual/allegro_id" target="_blank"><span class="a">allegro_id</span></a><span class="k2">)</span><span class="k2">;</span>
   <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"\nPress any key...\n"</span><span class="k2">)</span><span class="k2">;</span>
   <a href="http://www.delorie.com/djgpp/doc/libc/libc_383.html" target="_blank">getch</a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
   <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="k2">}</span>
<a href="http://www.allegro.cc/manual/END_OF_MAIN" target="_blank"><span class="a">END_OF_MAIN</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

Just for reference...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Onewing)</author>
		<pubDate>Tue, 21 Nov 2006 12:14:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
In GPAIO edition 2, here&#39;s that same bit of code:
</p></div></div><p>

Which still won&#39;t compile since <tt>stio.h</tt> is again not included. Even if it were, <tt>conio.h</tt> functions are not part of the C standard.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 21 Nov 2006 12:24:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Apparently, he wrote this code first:</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;conio.h&gt;</span>
<span class="p">#include &lt;stdio.h&gt;</span>

<span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="k2">{</span>
  <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Greetings Earthlings.\n"</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"All your base are belong to us!\n"</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.delorie.com/djgpp/doc/libc/libc_383.html" target="_blank">getch</a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
And the next bit he adds the allegro stuff to that code.  Somehow, stdio.h turned into stdlib.h for some reason.  Also note in the first bit (the code I just posted), there&#39;s no return value at the end of main. <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" /></p><p>Given, he didn&#39;t say this book was meant to be used for learning C nor did he mention it uses standard C.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Onewing)</author>
		<pubDate>Tue, 21 Nov 2006 12:36:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Somehow, stdio.h turned into stdlib.h for some reason.
</p></div></div><p>

In the post by the OP, the book uses <tt>system()</tt>. This function resides in <tt>stdlib.h</tt>.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Given, he didn&#39;t say this book was meant to be used for learning C nor did he mention it uses standard C.
</p></div></div><p>

I guess he assumed all readers would be using DOS or Windows. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 21 Nov 2006 12:41:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think he assumed it was all money in his pocket, no matter what OS they used.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 21 Nov 2006 20:03:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Thomas Fjellstrom said:</div><div class="quote"><p>
He also <i>claims</i> to be a writer and a programmer.
</p></div></div><p>

That made me laugh, big time :-D
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Dalrymple)</author>
		<pubDate>Sat, 25 Nov 2006 09:58:29 +0000</pubDate>
	</item>
</rss>
