<?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>Comments on: 1.9 &#8212; Header files</title>
	<atom:link href="http://www.learncpp.com/cpp-tutorial/19-header-files/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.learncpp.com/cpp-tutorial/19-header-files/</link>
	<description></description>
	<pubDate>Sun, 20 Jul 2008 14:27:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Kess</title>
		<link>http://www.learncpp.com/cpp-tutorial/19-header-files/#comment-21098</link>
		<dc:creator>Kess</dc:creator>
		<pubDate>Thu, 17 Jul 2008 03:30:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=32#comment-21098</guid>
		<description>I had this problem too and couldn’t understand what was being wrong (I was trying out the IDE Geany).

Until I realised that Geany didn’t compile both of the two .cpp files, and link them together.

When I manually compiled/linked them with g++ it worked just fine.</description>
		<content:encoded><![CDATA[<p>I had this problem too and couldn’t understand what was being wrong (I was trying out the IDE Geany).</p>
<p>Until I realised that Geany didn’t compile both of the two .cpp files, and link them together.</p>
<p>When I manually compiled/linked them with g++ it worked just fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: moonrat</title>
		<link>http://www.learncpp.com/cpp-tutorial/19-header-files/#comment-20535</link>
		<dc:creator>moonrat</dc:creator>
		<pubDate>Tue, 08 Jul 2008 14:43:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=32#comment-20535</guid>
		<description>I'm guessing
This way, older programs that include #include  do not need to be rewritten, and newer programs can #include 
should read
This way, older programs that include #include iostream.c  do not need to be rewritten, and newer programs can #include &#60;iostream&#62;&lt;!--formatted--&gt;</description>
		<content:encoded><![CDATA[<p>I&#8217;m guessing<br />
This way, older programs that include #include  do not need to be rewritten, and newer programs can #include<br />
should read<br />
This way, older programs that include #include iostream.c  do not need to be rewritten, and newer programs can #include &lt;iostream&gt;<!--formatted--></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joyel</title>
		<link>http://www.learncpp.com/cpp-tutorial/19-header-files/#comment-19955</link>
		<dc:creator>Joyel</dc:creator>
		<pubDate>Sat, 28 Jun 2008 05:30:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=32#comment-19955</guid>
		<description>Another interesting part of the tutorial.  I learnt a lot about namespaces here.  Thanks again for the great tutorial</description>
		<content:encoded><![CDATA[<p>Another interesting part of the tutorial.  I learnt a lot about namespaces here.  Thanks again for the great tutorial</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chase</title>
		<link>http://www.learncpp.com/cpp-tutorial/19-header-files/#comment-14363</link>
		<dc:creator>Chase</dc:creator>
		<pubDate>Sun, 04 May 2008 23:10:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=32#comment-14363</guid>
		<description>Nevermind, I got it to work by changing the header from:

add(int x, int y)

to:

add(int x, int y)
{ return x + y:  }</description>
		<content:encoded><![CDATA[<p>Nevermind, I got it to work by changing the header from:</p>
<p>add(int x, int y)</p>
<p>to:</p>
<p>add(int x, int y)<br />
{ return x + y:  }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chase</title>
		<link>http://www.learncpp.com/cpp-tutorial/19-header-files/#comment-14041</link>
		<dc:creator>Chase</dc:creator>
		<pubDate>Sat, 03 May 2008 01:54:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=32#comment-14041</guid>
		<description>I use Bloodshed Dev-C++ and i keep geting these error messages while trying to compile:
 
C:Dev-CppMakefile.win [Build Error]  [Project1.exe] Error 1 

  ld returned 1 exit status 

  [Linker error] undefined reference to `add(int, int)' 

I copied the add header and saved it as a .h file in the same directory as the project. Has anyone else had this error? How can I fix it?</description>
		<content:encoded><![CDATA[<p>I use Bloodshed Dev-C++ and i keep geting these error messages while trying to compile:</p>
<p>C:Dev-CppMakefile.win [Build Error]  [Project1.exe] Error 1 </p>
<p>  ld returned 1 exit status </p>
<p>  [Linker error] undefined reference to `add(int, int)&#8217; </p>
<p>I copied the add header and saved it as a .h file in the same directory as the project. Has anyone else had this error? How can I fix it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 1.10 &#8212; A first look at the preprocessor</title>
		<link>http://www.learncpp.com/cpp-tutorial/19-header-files/#comment-12591</link>
		<dc:creator>Learn C++ - &#187; 1.10 &#8212; A first look at the preprocessor</dc:creator>
		<pubDate>Wed, 23 Apr 2008 01:40:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=32#comment-12591</guid>
		<description>[...] 2007      Prev/Next Posts   &#171; 1.9 &#8212; Header files &#124; Home &#124; 1.11 &#8212; Comprehensive quiz &#187;     Sunday, June 3rd, 2007 at 12:57 [...]</description>
		<content:encoded><![CDATA[<p>[...] 2007      Prev/Next Posts   &laquo; 1.9 &#8212; Header files | Home | 1.11 &#8212; Comprehensive quiz &raquo;     Sunday, June 3rd, 2007 at 12:57 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.learncpp.com/cpp-tutorial/19-header-files/#comment-10090</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 21 Mar 2008 18:12:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=32#comment-10090</guid>
		<description>As you've noted, the header guards prevent the header files from being included multiple times.  It's a sloppy way of doing things, in my opinion, but it works and it's the standard way to do it.

Ideally, you should include your header file in every .cpp file in which you use the stuff it declares.  However, in practice, since header files can include other header files, this may not be strictly necessary.  For example, you might have a class named Foo that uses strings, so foo.h will include string.h.  foo.cpp (which also uses strings) should ideally include both foo.h and string.h, but since foo.h already includes string.h, if you only include foo.h you will still be able to use strings.</description>
		<content:encoded><![CDATA[<p>As you&#8217;ve noted, the header guards prevent the header files from being included multiple times.  It&#8217;s a sloppy way of doing things, in my opinion, but it works and it&#8217;s the standard way to do it.</p>
<p>Ideally, you should include your header file in every .cpp file in which you use the stuff it declares.  However, in practice, since header files can include other header files, this may not be strictly necessary.  For example, you might have a class named Foo that uses strings, so foo.h will include string.h.  foo.cpp (which also uses strings) should ideally include both foo.h and string.h, but since foo.h already includes string.h, if you only include foo.h you will still be able to use strings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ewinz87</title>
		<link>http://www.learncpp.com/cpp-tutorial/19-header-files/#comment-10066</link>
		<dc:creator>Ewinz87</dc:creator>
		<pubDate>Fri, 21 Mar 2008 06:44:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=32#comment-10066</guid>
		<description>Hmm, first of all great job with the tutorials. I have finally decided to familiarize myself with C++ and I really like it so far, however I'm a bit confused with this and have a question.

So my question is the following: Should  be include the header file for every source file (in this case I'm thinking about add.cpp or can we only use it for one source file. Also, isn't it going to scream at us for "redefining?" the functions?

Edit: I just found out. The header guard prevent that from happenning. As for using it in all the source files makes it easier and saves times?

Excuse my english, it is not my native tongue. :P</description>
		<content:encoded><![CDATA[<p>Hmm, first of all great job with the tutorials. I have finally decided to familiarize myself with C++ and I really like it so far, however I&#8217;m a bit confused with this and have a question.</p>
<p>So my question is the following: Should  be include the header file for every source file (in this case I&#8217;m thinking about add.cpp or can we only use it for one source file. Also, isn&#8217;t it going to scream at us for &#8220;redefining?&#8221; the functions?</p>
<p>Edit: I just found out. The header guard prevent that from happenning. As for using it in all the source files makes it easier and saves times?</p>
<p>Excuse my english, it is not my native tongue. :P</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Learn C++ - &#187; 7.1 -- Function parameters and arguments</title>
		<link>http://www.learncpp.com/cpp-tutorial/19-header-files/#comment-9997</link>
		<dc:creator>Learn C++ - &#187; 7.1 -- Function parameters and arguments</dc:creator>
		<pubDate>Thu, 20 Mar 2008 05:17:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=32#comment-9997</guid>
		<description>[...] Header files [...]</description>
		<content:encoded><![CDATA[<p>[...] Header files [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jestuart</title>
		<link>http://www.learncpp.com/cpp-tutorial/19-header-files/#comment-8183</link>
		<dc:creator>jestuart</dc:creator>
		<pubDate>Wed, 20 Feb 2008 01:54:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.learncpp.com/?p=32#comment-8183</guid>
		<description>Spot on that worked. I changed MATH.cpp to Math.h and it worked fine. Thanks for the tutorial and the response Alex.</description>
		<content:encoded><![CDATA[<p>Spot on that worked. I changed MATH.cpp to Math.h and it worked fine. Thanks for the tutorial and the response Alex.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
