<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Than Win Naing &#187; C++</title>
	<atom:link href="http://www.thanwinnaing.net/tag/c/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thanwinnaing.net</link>
	<description>Yangon, Myanmar.</description>
	<lastBuildDate>Mon, 03 Oct 2011 01:26:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>C++ on Ubuntu 9.04</title>
		<link>http://www.thanwinnaing.net/cpponubuntu</link>
		<comments>http://www.thanwinnaing.net/cpponubuntu#comments</comments>
		<pubDate>Sat, 30 May 2009 15:33:18 +0000</pubDate>
		<dc:creator>ktwn</dc:creator>
				<category><![CDATA[Diary]]></category>
		<category><![CDATA[IT related]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[My Test]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.thanwinnaing.net/?p=129</guid>
		<description><![CDATA[I want to test C++ on Ubuntu 9.04. So, follow this post from www.ubuntugeek.com. This post said that&#8230;&#8230;&#8230; If you are a developer you need C and C++ Compiler for your development work. In Ubuntu you can install the build-essential &#8230; <a href="http://www.thanwinnaing.net/cpponubuntu">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I want to test C++ on Ubuntu 9.04.</p>
<p>So, follow this <a href="http://www.ubuntugeek.com/how-to-install-c-and-c-compilers-in-ubuntu-and-testing-your-first-c-and-c-program.html/comment-page-2#comment-9547">post</a> from <a href="http://www.ubuntugeek.com">www.ubuntugeek.com</a>. This post said that&#8230;&#8230;&#8230;</p>
<p>If you are a developer you need C and C++ Compiler for your development work. In Ubuntu you can install the build-essential for C and C++ compilers.</p>
<h3><span style="text-decoration: underline;">Install C and C++ Compilers in Ubuntu</span></h3>
<blockquote><p>sudo aptitude install build-essential</p></blockquote>
<p>This will install all the required packages for C and C++ compilers</p>
<h3></h3>
<h3><span style="text-decoration: underline;">Testing C and C++ Programs</span></h3>
<ul>
<li>
<h5>Compiling Your first C Programs</h5>
</li>
</ul>
<p>Now you need to open first.c file</p>
<blockquote><p>sudo gedit first.c</p></blockquote>
<p>add the following lines save and exit the file</p>
<blockquote><p>#include &lt;stdio.h&gt;<br />
int main()<br />
{<br />
printf(&#8220;Hello, World!\n&#8221;);<br />
return 0;<br />
}</p></blockquote>
<p>Firstly compile the code using the following command</p>
<blockquote><p>cc -c first.c</p></blockquote>
<p>that would produce an object file you may need to add to the library.<br />
then create an executable using the following command</p>
<blockquote><p>cc -o first first.c</p></blockquote>
<p>Now run this executable using the following command</p>
<blockquote><p>./first</p></blockquote>
<p>Output should show as follows</p>
<blockquote><p>Hello, world</p></blockquote>
<ul>
<li>
<h5>Compiling your first C++ program</h5>
</li>
</ul>
<p>If you want to run c++ program follow this procedure<br />
g++ is the compiler that you must use.<br />
you should use a .cpp file extension rather than a .c one<br />
You need to create a file</p>
<blockquote><p>sudo gedit first.cpp</p></blockquote>
<p>add the following lines save and exit the file</p>
<blockquote><p>#include &lt;iostream&gt;<br />
int main()<br />
{<br />
std::cout &lt;&lt; &#8220;Hello, World!&#8221; &lt;&lt; std::endl;<br />
return 0;<br />
}</p></blockquote>
<p>Run your C++ Program using the following command</p>
<blockquote><p>g++ first.cpp -o test</p>
<p>./test</p></blockquote>
<p>Output should show as follows</p>
<blockquote><p>Hello World!</p></blockquote>
<h4>And I test on my Toshiba laptop.</h4>
<blockquote><p>thanwinnaing@thanwinnaing-laptop:~$ sudo apt-get install build-essential<br />
Reading package lists&#8230; Done<br />
Building dependency tree<br />
Reading state information&#8230; Done<br />
The following extra packages will be installed:<br />
dpkg-dev g++ g++-4.3 libstdc++6-4.3-dev patch<br />
Suggested packages:<br />
debian-keyring g++-multilib g++-4.3-multilib gcc-4.3-doc libstdc++6-4.3-dbg<br />
libstdc++6-4.3-doc diff-doc<br />
The following NEW packages will be installed:<br />
build-essential dpkg-dev g++ g++-4.3 libstdc++6-4.3-dev patch<br />
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.<br />
Need to get 6270kB of archives.<br />
After this operation, 21.4MB of additional disk space will be used.<br />
Do you want to continue [Y/n]? y<br />
Get:1 http://ftp.tcc.edu.tw jaunty/main libstdc++6-4.3-dev 4.3.3-5ubuntu4 [1356kB]<br />
Get:2 http://ftp.tcc.edu.tw jaunty/main g++-4.3 4.3.3-5ubuntu4 [4162kB]<br />
Get:3 http://ftp.tcc.edu.tw jaunty/main g++ 4:4.3.3-1ubuntu1 [1438B]<br />
Get:4 http://ftp.tcc.edu.tw jaunty/main patch 2.5.9-5 [100kB]<br />
Get:5 http://ftp.tcc.edu.tw jaunty/main dpkg-dev 1.14.24ubuntu1 [643kB]<br />
Get:6 http://ftp.tcc.edu.tw jaunty/main build-essential 11.4 [7172B]<br />
Fetched 6211kB in 9min 57s (10.4kB/s)<br />
Selecting previously deselected package libstdc++6-4.3-dev.<br />
(Reading database &#8230; 103569 files and directories currently installed.)<br />
Unpacking libstdc++6-4.3-dev (from &#8230;/libstdc++6-4.3-dev_4.3.3-5ubuntu4_i386.deb) &#8230;<br />
Selecting previously deselected package g++-4.3.<br />
Unpacking g++-4.3 (from &#8230;/g++-4.3_4.3.3-5ubuntu4_i386.deb) &#8230;<br />
Selecting previously deselected package g++.<br />
Unpacking g++ (from &#8230;/g++_4%3a4.3.3-1ubuntu1_i386.deb) &#8230;<br />
Selecting previously deselected package patch.<br />
Unpacking patch (from &#8230;/patch_2.5.9-5_i386.deb) &#8230;<br />
Selecting previously deselected package dpkg-dev.<br />
Unpacking dpkg-dev (from &#8230;/dpkg-dev_1.14.24ubuntu1_all.deb) &#8230;<br />
Selecting previously deselected package build-essential.<br />
Unpacking build-essential (from &#8230;/build-essential_11.4_i386.deb) &#8230;<br />
Processing triggers for man-db &#8230;<br />
Setting up patch (2.5.9-5) &#8230;<br />
Setting up dpkg-dev (1.14.24ubuntu1) &#8230;<br />
Setting up libstdc++6-4.3-dev (4.3.3-5ubuntu4) &#8230;<br />
Setting up g++-4.3 (4.3.3-5ubuntu4) &#8230;<br />
Setting up g++ (4:4.3.3-1ubuntu1) &#8230;</p>
<p>Setting up build-essential (11.4) &#8230;<br />
thanwinnaing@thanwinnaing-laptop:~$</p></blockquote>
<p>But, I test with this code only for C++ which is the same above. <img src='http://www.thanwinnaing.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p>#include&lt;iostream&gt;<br />
using namespace std;<br />
int main()<br />
{<br />
cout &lt;&lt; &#8220;Hello, World!&#8221; &lt;&lt; endl;<br />
return 0;<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.thanwinnaing.net/cpponubuntu/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

