<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>#define  -WARNiNG</title>
		<link>http://www.allegro.cc/forums/view/591066</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 18 Apr 2007 20:37:12 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I am using VS6, and after changing my #define (macros..) values, I got warnings, of macro redefinition. If I comment the #defines, the game works, as if I would be using my previous definitions.</p><p>First time, I defined the values, I had no warnings, no errors. It looks like the macros are stored somewhere else. I am using &quot;win32 console application&quot;.</p><p>The Code:</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#define USE_CONSOLE</span>
<span class="p">#include &lt;ALLEGRO.H&gt;</span>
<span class="p">#include &lt;MATH.H&gt;</span>

<span class="p">#define RESOX  800</span>
<span class="p">#define RESOY  800</span>
<span class="p">#define RESOZ  800</span>

<span class="p">#define MiD    400</span>
<span class="p">#define LENGTH  200</span>
<span class="p">#define PER_0 1600</span>
</pre></div></div><p>

The warnings: </p><div class="source-code snippet"><div class="inner"><pre>D:\nvm\C\<span class="n">3DA3b</span>\MAiN n ONLY.cpp<span class="k2">(</span><span class="n">6</span><span class="k2">)</span> <span class="k2">:</span> warning C4005: <span class="s">'RESOY'</span> <span class="k2">:</span> macro redefinition
        d:\nvm\c\<span class="n">3da3b</span>\main n only.cpp<span class="k2">(</span><span class="n">6</span><span class="k2">)</span> <span class="k2">:</span> see previous definition of <span class="s">'RESOY'</span>
D:\nvm\C\<span class="n">3DA3b</span>\MAiN n ONLY.cpp<span class="k2">(</span><span class="n">7</span><span class="k2">)</span> <span class="k2">:</span> warning C4005: <span class="s">'RESOZ'</span> <span class="k2">:</span> macro redefinition
        d:\nvm\c\<span class="n">3da3b</span>\main n only.cpp<span class="k2">(</span><span class="n">7</span><span class="k2">)</span> <span class="k2">:</span> see previous definition of <span class="s">'RESOZ'</span>
D:\nvm\C\<span class="n">3DA3b</span>\MAiN n ONLY.cpp<span class="k2">(</span><span class="n">9</span><span class="k2">)</span> <span class="k2">:</span> warning C4005: <span class="s">'MiD'</span> <span class="k2">:</span> macro redefinition
        d:\nvm\c\<span class="n">3da3b</span>\main n only.cpp<span class="k2">(</span><span class="n">9</span><span class="k2">)</span> <span class="k2">:</span> see previous definition of <span class="s">'MiD'</span>
D:\nvm\C\<span class="n">3DA3b</span>\MAiN n ONLY.cpp<span class="k2">(</span><span class="n">10</span><span class="k2">)</span> <span class="k2">:</span> warning C4005: <span class="s">'LENGTH'</span> <span class="k2">:</span> macro redefinition
        d:\nvm\c\<span class="n">3da3b</span>\main n only.cpp<span class="k2">(</span><span class="n">10</span><span class="k2">)</span> <span class="k2">:</span> see previous definition of <span class="s">'LENGTH'</span>
</pre></div></div><p>

Help please, i hate getting warnings, also slows down the progress when i get something important.</p><p>Thanks..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (type568)</author>
		<pubDate>Wed, 18 Apr 2007 17:32:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You have them defined somewhere elese in your code.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 18 Apr 2007 17:35:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It can&#39;t be, there&#39;s only 1 file. Here&#39;s all the project. (a lot of other files, made auto by VS..)</p><p>Also, the code given is the top(of the file). And, pressing F4, following the message  directs me there..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (type568)</author>
		<pubDate>Wed, 18 Apr 2007 18:00:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>make a test project, and see if you get the same errors if you make the same defines. If so, they&#39;re reserved words for VS6, for some reason.</p><p>edit: never mind. The problem is that you don&#39;t use header guards, and most of your .cpp files include header.h, wich in turn includes #define.h. So the defines get included multiple times.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Wed, 18 Apr 2007 18:04:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Linking...</p><p>test1.exe - 0 error(s), 0 warning(s)</p><p>I made a new project, empty, made a file, copied there all the source, and it&#39;s fine.</p><p>I changed values of the macros, and didn&#39;t get any warning.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (type568)</author>
		<pubDate>Wed, 18 Apr 2007 18:09:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>See my edit above.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Wed, 18 Apr 2007 18:10:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh. How do I use them though?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (type568)</author>
		<pubDate>Wed, 18 Apr 2007 20:25:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In the define.h file, do this:</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#ifndef DEFINE_H</span>
<span class="p">#define DEFINE_H</span>
...
<a href="http://www.allegro.cc/manual/rest" target="_blank"><span class="a">rest</span></a> of header file here
...
<span class="p">#endif</span>
</pre></div></div><p>

Similarly for EVREY header file that will be included by more than one file. The exact term you define doesn&#39;t really matter, but what I did above is standard (taking the header name, capitalizing it, and replacing the . with _).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Wed, 18 Apr 2007 20:29:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;ALLEGRO.H&gt;</span>
<span class="p">#include &lt;MATH.H&gt;</span>
</pre></div></div><p>
</p></div></div><p>No, it&#39;s &quot;allegro.h&quot; and &quot;math.h&quot;, in lowercase. Windows doesn&#39;t mind, but every other operating system does.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Wed, 18 Apr 2007 20:32:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks, though in my case than doesn&#39;t matter.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (type568)</author>
		<pubDate>Wed, 18 Apr 2007 20:37:12 +0000</pubDate>
	</item>
</rss>
