<?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>சுதர்சன் சாந்தியப்பன் &#187; c++</title>
	<atom:link href="http://sudarsun.in/blog/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://sudarsun.in/blog</link>
	<description>Dream of the Impossible™</description>
	<lastBuildDate>Sun, 05 Feb 2012 12:03:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Hash Overflow due to 64 bit upcasting</title>
		<link>http://sudarsun.in/blog/2011/10/hash-overflow-due-to-64-bit-upcasting/</link>
		<comments>http://sudarsun.in/blog/2011/10/hash-overflow-due-to-64-bit-upcasting/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 12:36:24 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Help]]></category>
		<category><![CDATA[KnowHow]]></category>
		<category><![CDATA[KnowWhat]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[32 bit]]></category>
		<category><![CDATA[64 bit]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[data types]]></category>
		<category><![CDATA[g++]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[hashing]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mint]]></category>
		<category><![CDATA[overflow]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[win64]]></category>
		<category><![CDATA[x64]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2011/10/hash-overflow-due-to-64-bit-upcasting/</guid>
		<description><![CDATA[&#160;&#160;&#160; Lately, I had to debug the following piece of code, where it caused overflow on the hash bucket design.&#160; The code worked perfectly on a Windows machine while compiled for Win32, but failed to work on a Linux Mint x64 machine.&#160; The code is listed below, which basically calculates hash value of an input [...]]]></description>
			<content:encoded><![CDATA[<div align="justify">&nbsp;&nbsp;&nbsp; Lately, I had to debug the following piece of code, where it caused overflow on the hash bucket design.&nbsp; The code worked perfectly on a Windows machine while compiled for Win32, but failed to work on a Linux Mint x64 machine.&nbsp; The code is listed below, which basically calculates hash value of an input 32 bit unsigned number, limiting the hash value to 2^10 (1Meg).</div>
<blockquote><p><font face="Courier New">hash = ( fpArray*2654404609 )&gt;&gt;12; // Calculate the hash and limit the value to 2^20 (1 Meg)</font></p></blockquote>
<div align="justify">&nbsp;&nbsp; When the input value for fpArray was 1724463449 (0x66C93959), the hash value generated was 1779068547 (0x6A0A6E83), which is more than (0x000FFFFF) to cause the hash bucket overflow.</div>
<blockquote><p> <font face="Courier New">unsigned hash = fpArray * 2654404609;<br /> hash = hash &gt;&gt; 12;</font></p></blockquote>
<div align="justify">&nbsp;&nbsp;&nbsp; When I rewrote the code like the above, the value of hash was 2800236889 (0xA6E83959).&nbsp; Upon shifting right by 12 yields 638651 (0x0009BEBB), which is the correct and expected hash value.</div>
<p>
<div align="justify">&nbsp;&nbsp;&nbsp; Overall, the first snippet of code appears to be correct.&nbsp; Do you see a problem there?&nbsp; I couldn&#8217;t find the issue, until I recalled the 32bit vs 64bit difference.&nbsp; If you carefully look at the multiplier 2654404609 (0x9E370001), although appears to be a valid 32 bit number, what is the default assignment of type to this number by the compiler?&nbsp; If it was assigned 64bits, what would happen to the results?&nbsp; To validate this, I changed the 2nd snippet as the following.</div>
<blockquote><p>    <font face="Courier New">unsigned long hash = (unsigned long)fpArray * 2654404609;<br />    hash = hash &gt;&gt; 12;<br />    unsigned h2 = (unsigned)hash;</font></p></blockquote>
<div align="justify">&nbsp;&nbsp;&nbsp; Now, when the input is the same 1724463449 (0x66C93959), the value of hash becomes 4577423727077636441 (0x3F8646A0A6E83959) and upon right shifting by 12 bits yields 1117535089618563 (0x0003F8646A0A6E83).  Followed by downcasting to unsigned yield 1779068547 (0x6A0A6E83). Bingo!</div>
<p>
<div align="justify">&nbsp;&nbsp;&nbsp; So, what is happening here? While performing (fpArray * 2654404609), the computation is upcasted to 64bit computation by the 64 bit compiler.&nbsp; So, what is the solution? Just put a &#8220;U&#8221; at the end of the constant.</div>
<blockquote><p><font face="Courier New">hash = ( fpArray*2654404609U )&gt;&gt;12; // Calculate the hash and limit the value to 2^20 (1 Meg)<br />(or)<br />const unsigned multipler = 2654404609; // here U suffix is not needed as the constant is explicitly made unsigned<br />hash = ( fpArray * multiplier ) &gt;&gt; 12;</font></p></blockquote>
<p>&nbsp;&nbsp;&nbsp; Now, the computation will happen with 32 bit numbers to get the expected outputs.</p>
<p><b>Lessons Learned here:</b>
<ol>
<li>While using constants, beware of the upcasting and downcasting. So use proper suffixes like U, L, F etc.</li>
<li>Instead of using constants directly in expressions, use them as constant variables.</li>
<li>Be conscious about the compiler type and the assumptions made by the compiler in different build modes.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2011/10/hash-overflow-due-to-64-bit-upcasting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>no include path in which to search for limits.h</title>
		<link>http://sudarsun.in/blog/2011/06/no-include-path-in-which-to-search-for-limits-h/</link>
		<comments>http://sudarsun.in/blog/2011/06/no-include-path-in-which-to-search-for-limits-h/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 05:28:53 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[KnowWhat]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[compilation]]></category>
		<category><![CDATA[g++]]></category>
		<category><![CDATA[include_next]]></category>
		<category><![CDATA[limits.h]]></category>
		<category><![CDATA[stlport]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2011/06/no-include-path-in-which-to-search-for-limits-h/</guid>
		<description><![CDATA[Why compiling STLport 5.1.5 using g++-4.4, one might get an error like the following:- Building CXX object libs/bgt/CMakeFiles/bgt.dir/error.oIn file included from /opt/projects/stl/stlport/limits.h:27,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from /usr/include/c++/4.4/../4.4.5/climits:43,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from /opt/projects/stl/stlport/climits:27,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from /opt/projects/stl/stlport/stl/_algobase.h:42,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from /opt/projects/stl/stlport/stl/_alloc.h:47,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from /opt/projects/stl/stlport/stl/_string.h:23,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from /opt/projects/stl/stlport/stl/_ios_base.h:34,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from /opt/projects/stl/stlport/stl/_ios.h:23,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from /opt/projects/stl/stlport/stl/_ostream.h:24,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from /opt/projects/stl/stlport/ostream:31,&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from /opt/projects/dev/libs/bgt/error.cpp:18:/usr/include/../include/limits.h:125: error: no include path in which to search for limits.hIn file included from [...]]]></description>
			<content:encoded><![CDATA[<p>Why compiling STLport 5.1.5 using g++-4.4, one might get an error like the following:-<br />
<blockquote>Building CXX object libs/bgt/CMakeFiles/bgt.dir/error.o<br />In file included from /opt/projects/stl/stlport/limits.h:27,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/include/c++/4.4/../4.4.5/climits:43,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/climits:27,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/stl/_algobase.h:42,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/stl/_alloc.h:47,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/stl/_string.h:23,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/stl/_ios_base.h:34,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/stl/_ios.h:23,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/stl/_ostream.h:24,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/ostream:31,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/dev/libs/bgt/error.cpp:18:<br /><b><font color="red">/usr/include/../include/limits.h:125: error: no include path in which to search for limits.h</font></b><br />In file included from /opt/projects/stl/stlport/stl/_num_put.c:26,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/stl/_num_put.h:183,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/stl/_ostream.c:26,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/stl/_ostream.h:380,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/stl/stlport/ostream:31,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/projects/dev/libs/bgt/error.cpp:18:<br />/opt/projects/stl/stlport/stl/_limits.h:148: error: ‘CHAR_BIT’ was not declared in this scope<br />/opt/projects/stl/stlport/stl/_limits.h:253: error: ‘CHAR_MIN’ was not declared in this scope<br />..</p></blockquote>
<p>Looks like it is a bug in the STLport package itself as per the <a href="http://stlport.sourceforge.net/News.shtml" target="_blank">Release notes</a> of STLport.&nbsp; After updating to STLport-5.2.1, the issue got fixed automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2011/06/no-include-path-in-which-to-search-for-limits-h/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MongoDB C++ Wrapper</title>
		<link>http://sudarsun.in/blog/2011/04/mongodb-c-wrapper/</link>
		<comments>http://sudarsun.in/blog/2011/04/mongodb-c-wrapper/#comments</comments>
		<pubDate>Sun, 03 Apr 2011 17:09:50 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[boost]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[mongo]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[stlport]]></category>
		<category><![CDATA[wrapper]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2011/04/mongodb-c-wrapper/</guid>
		<description><![CDATA[MongoDB has drivers in almost all language.&#160; Being a C++ programmer,&#160; although there is a C++ driver, I am stinged to see that the driver cannot be used with STLport.&#160; The reason being, C++ MongoDB driver is compiled with Boost, which does not go well with STLport.&#160; I could link my application in Release mode, [...]]]></description>
			<content:encoded><![CDATA[<p>MongoDB has drivers in almost all language.&nbsp; Being a C++ programmer,&nbsp; although there is a C++ driver, I am stinged to see that the driver cannot be used with STLport.&nbsp; The reason being, C++ MongoDB driver is compiled with Boost, which does not go well with STLport.&nbsp; I could link my application in Release mode, but debug mode would not work.&nbsp; Also, Boost says that STLport is not uniform across platforms, they don&#8217;t support STLport for linux platforms. </p>
<p>So, I am left out with only one option; that is to create a C++ driver myself.&nbsp; I found the C driver working excellently (although there are design glitches!).&nbsp; I am currently developing a C++ wrapper around the C driver to support fundamental operations on Mongo from an application compiled with STLport in C++ and cross platform.</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=62165902-a154-8a8f-a4b8-9fa69da9afa1" /></div>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2011/04/mongodb-c-wrapper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First Application using MongoDB &amp; PHP</title>
		<link>http://sudarsun.in/blog/2011/03/first-application-using-mongodb-php/</link>
		<comments>http://sudarsun.in/blog/2011/03/first-application-using-mongodb-php/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 17:25:38 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[KnowWhat]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[boost]]></category>
		<category><![CDATA[bson]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[iiit hyd]]></category>
		<category><![CDATA[jpeg]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[mongo]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[slideshow]]></category>
		<category><![CDATA[stlport]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2011/03/first-application-using-mongodb-php/</guid>
		<description><![CDATA[I have been eyeing on MongoDB since I had visited IIIT Hyderabad for campus placements in Jan 2011.&#160; The name MongoDB was introduced to me by the candidates whom I had to interview.&#160; Infact all the candidates who took the interview had worked on MongoDB for solving some problem during their graduate studies.&#160;&#160; MongoDB, the [...]]]></description>
			<content:encoded><![CDATA[<div align="justify">I have been eyeing on MongoDB since I had visited IIIT Hyderabad for campus placements in Jan 2011.&nbsp; The name MongoDB was introduced to me by the candidates whom I had to interview.&nbsp; Infact all the candidates who took the interview had worked on MongoDB for solving some problem during their graduate studies.&nbsp;&nbsp; MongoDB, the name comes from Hu<b>Mongo</b>us <b>D</b>ata<b>B</b>ase, which is a well instituted name and the database indeed is meant for storing tonnes of data organized in JSON format.&nbsp;&nbsp; Being a C++ coder, I had less experience with JSON and have always avoided that as it was primarily used in the Web application development.&nbsp; After learning about Mongo in the official wiki, I got thrilled by the simplicity of JSON format and the advantage of it over the conventional XML format and infact decided to use JSON for a project that my team is working on.
</div>
<div align="justify">MongoDB is written in C++, which increased my love towards the database.&nbsp; I wanted to use MongoDB for my product development data store needs, but was stuck with the dependencies of Mongo&#8217;s C++ driver, where it wanted Boost libraries to be linked.&nbsp; The pathetic problem is boost does not compile with the debug version of STLport.&nbsp; My product is built on STLport, so I have to link MongoDB with Boost/STLport, which works well in release mode, but not in DEBUG mode.&nbsp; How Sad!
</div>
<div align="justify">My desperation grew as I wanted to have some useful application developed using MongoDB.&nbsp; PHP came for my rescue. The PHP driver that was available with MongoDB is a cute baby.&nbsp;&nbsp; I works like moon walk, when copy pasted on the PHP&#8217;s extension folder.&nbsp;&nbsp; The documentation of PHP/MongoDB is well written and has lot of examples.&nbsp; Also, there is awesome support available in the internet for all the doubts that I got while building my Brower based Photo SlideShow web application.&nbsp; All, I did was, I pushed all my JPEG files into MongoDB and wrote simple PHP scripts to fetch the files based on the file name.&nbsp; When the file name was not mentioned, my script would pick a file randomly.&nbsp; I have presented the code below:
</div>
<pre># view.php

# get the file id
$id = "";
if ( array_key_exists( "id", $_REQUEST ) ) {
&nbsp;&nbsp;&nbsp; $id = $_REQUEST["id"];
}

# open database connectivity
$conn = new Mongo();
$store = $conn-&gt;store;
$image = $store-&gt;image;

# fetch the file as per the id or just randomly
if ( $id != "" ) {
&nbsp;&nbsp;&nbsp; $query = array ( 'id' =&gt; $id );
&nbsp;&nbsp;&nbsp; $cursor = $image-&gt;find( $query );
}
else {
    # set the html headers for refreshing the page every 3 sec.
    header( 'Refresh: 3;' );

    # Random fetch logic, get the count first.
&nbsp;&nbsp;&nbsp; $count = $image-&gt;find()-&gt;count();
&nbsp;&nbsp;&nbsp; $rand = rand( 1, $count-1 );  # generate a random number.
    # skip several records of the cursor based on the random number
&nbsp;&nbsp;&nbsp; $cursor = $image-&gt;find()-&gt;skip( $rand )-&gt;limit(1);
}

# write output stream as JPEG content
header( 'Content-Type: image/jpeg' );
foreach ( $cursor as $obj ) {
    # decode the data, and just write on the output stream.
&nbsp;&nbsp;&nbsp; echo base64_decode($obj["data"]);
}

# import.php

$dir = $_REQUEST["dir"];
if ( $dir == "" ) {
    echo "&lt;h2&gt;Import directory cannot be empty&lt;/h2&gt;";
    exit;
}

$conn = new Mongo();
$db = $conn-&gt;store;
$image = $db-&gt;image;

echo "&lt;ol&gt;";
$dhandle = opendir( $dir );
while ( ($file = readdir( $dhandle )) != false ) {
    $path = $dir."/".$file;
    if ( is_dir( $path ) ) {
        continue;
    }

    $path = str_replace( '\\', '/', $path );
    $handle = fopen( $path, "rb" );
    $data = fread( $handle, filesize( $path ) );
    fclose( $handle );
    if ( $data == false ) {
	continue;
    }

    $key = preg_replace( "/[[:punct:]]/", "_", $file );
    echo "&lt;li&gt;Importing $path (Key: $key)...";
    try {
        $image-&gt;insert( array( "id" =&gt; $key,
               "data" =&gt; base64_encode( $data ) ), true );
        echo "Success";
    }
    catch ( MongoCursorException $e ) {
        echo "Exception: $e";
    }

    echo "&lt;/li&gt;";
    ob_flush();
}

echo "&lt;/ol&gt;";
</pre>
<p>Within minutes, I was able to have a browser based slide show application, which protected all my image files in the Database without being exposed out in the folder system.</p>
<p>I am enjoying every bit of Mongo, and hope to develop several application using that in the future.</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=914af7d4-5f56-8fc6-bd0b-fefdfe96d1c0" /></div>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2011/03/first-application-using-mongodb-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ACE 5.6.7 does not compile with STLport in Win32 environment</title>
		<link>http://sudarsun.in/blog/2010/06/ace-5-6-7-does-not-compile-with-stlport-in-win32-environment/</link>
		<comments>http://sudarsun.in/blog/2010/06/ace-5-6-7-does-not-compile-with-stlport-in-win32-environment/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 11:56:24 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ace]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[checked_array_iterator]]></category>
		<category><![CDATA[checked_iterator]]></category>
		<category><![CDATA[iterator]]></category>
		<category><![CDATA[stlport]]></category>
		<category><![CDATA[tao]]></category>
		<category><![CDATA[vc8]]></category>
		<category><![CDATA[vc9]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[_STLP_ITERATOR]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2010/06/ace-5-6-7-does-not-compile-with-stlport-in-win32-environment/</guid>
		<description><![CDATA[ACE 5.6.7 does not compile with STLport in Windows environment (I used vc9 on Windows Server 2008) because of the following header in ACE (ACE_wrappers/ace/checked_iterator.h), which wrongly assumes the existence of stdext::checked_array_iterator in the iterator header.  A PRF is already submitted in the ACE mailing list (http://www.archivum.info/comp.soft-sys.ace/2008-07/00026/%5Bace-users%5D-Checked_iterator.h-problem-with-STLport..html) # if defined (_MSC_VER) &#38;&#38; (_MSC_FULL_VER &#62;= 140050000) [...]]]></description>
			<content:encoded><![CDATA[<p>ACE 5.6.7 does not compile with STLport in Windows environment (I used vc9 on Windows Server 2008) because of the following header in ACE (<em>ACE_wrappers/ace/checked_iterator.h</em>), which wrongly assumes the existence of <span style="font-family: Courier New;">stdext::checked_array_iterator </span>in the <strong><em>iterator</em></strong> header.  A PRF is already submitted in the ACE mailing list (<a href="http://www.archivum.info/comp.soft-sys.ace/2008-07/00026/%5Bace-users%5D-Checked_iterator.h-problem-with-STLport..html" target="_blank">http://www.archivum.info/comp.soft-sys.ace/2008-07/00026/%5Bace-users%5D-Checked_iterator.h-problem-with-STLport..html</a>)</p>
<blockquote><p><span style="font-family: Courier New;"># if defined (_MSC_VER) &amp;&amp; (_MSC_FULL_VER &gt;= 140050000)<br />
// Checked iterators are currently only supported in MSVC++ 8 or better.<br />
#  include &lt;iterator&gt;<br />
# endif  /* _MSC_VER &gt;= 1400 */</span></p>
<p><span style="font-family: Courier New;"># if defined (_MSC_VER) &amp;&amp; (_MSC_FULL_VER &gt;= 140050000)<br />
template &lt;typename PTR&gt;<br />
</span><span style="font-family: Courier New;">stdext::checked_array_iterator&lt;PTR&gt;<br />
ACE_make_checked_array_iterator (PTR buf, size_t len)<br />
{<br />
return stdext::checked_array_iterator  (buf, len);<br />
}<br />
# else<br />
template &lt;typename PTR&gt;<br />
PTR<br />
ACE_make_checked_array_iterator (PTR buf, size_t /* len */)<br />
{<br />
// Checked iterators are unsupported.  Just return the pointer to<br />
// the buffer itself.<br />
return buf;<br />
}<br />
# endif  /* _MSC_VER &gt;= 1400 */</span></p>
<p><span style="font-family: Courier New;">#endif  /* ACE_CHECKED_ITERATOR_H */</span></p></blockquote>
<p>I need to develop a solution to it.  The easiest way to find a solution is to use some macro explicitly set by the STLport header, which is not set by any other STL libraries.  I chose to use the <strong>_STLP_ITERATOR</strong> macro set by &#8220;<em>stl/stlport/iterator</em>&#8221; header.</p>
<blockquote><p><span style="font-family: Courier New;">#ifndef _STLP_ITERATOR<br />
#define _STLP_ITERATOR</span></p>
<p><span style="font-family: Courier New;"># ifndef _STLP_OUTERMOST_HEADER_ID<br />
#  define _STLP_OUTERMOST_HEADER_ID 0&#215;38<br />
#  include &lt;stl/_prolog.h&gt;<br />
# endif</span></p>
<p><span style="font-family: Courier New;"># ifdef _STLP_PRAGMA_ONCE<br />
#  pragma once<br />
# endif</span></p>
<p><span style="font-family: Courier New;">#if defined (_STLP_IMPORT_VENDOR_STD)<br />
# include _STLP_NATIVE_HEADER(iterator)<br />
#endif /* IMPORT */</span></p>
<p><span style="font-family: Courier New;"># ifndef _STLP_INTERNAL_ITERATOR_H<br />
#  include &lt;stl/_iterator.h&gt;<br />
# endif</span></p>
<p><span style="font-family: Courier New;"># ifndef _STLP_INTERNAL_STREAM_ITERATOR_H<br />
#  include &lt;stl/_stream_iterator.h&gt;<br />
# endif</span></p>
<p><span style="font-family: Courier New;"># if (_STLP_OUTERMOST_HEADER_ID == 0&#215;38)<br />
#  include &lt;stl/_epilog.h&gt;<br />
#  undef _STLP_OUTERMOST_HEADER_ID<br />
# endif</span></p>
<p><span style="font-family: Courier New;">#endif /* _STLP_ITERATOR */<br />
</span></p></blockquote>
<p>The solution is the following, where I have added the <em><strong>!defined(_STLP_ITERATOR)</strong></em> condition along with the check for Visual Studio compiler version.</p>
<blockquote><p><span style="font-family: Courier New;"># if <strong>!defined(_STLP_ITERATOR) &amp;&amp;</strong> defined (_MSC_VER) &amp;&amp; (_MSC_FULL_VER &gt;= 140050000)</span><br />
<span style="font-family: Courier New;">// Checked iterators are currently only supported in MSVC++ 8 or better.</span><br />
<span style="font-family: Courier New;">#  include &lt;iterator&gt; </span><br />
<span style="font-family: Courier New;"># endif  /* _MSC_VER &gt;= 1400 */</span></p>
<p><span style="font-family: Courier New;"># if defined (_MSC_VER) &amp;&amp; (_MSC_FULL_VER &gt;= 140050000)</span><br />
<span style="font-family: Courier New;">template &lt;typename PTR&gt;<br />
</span><span style="font-family: Courier New;">stdext::checked_array_iterator </span><span style="font-family: Courier New;">&lt;PTR&gt;</span><br />
<span style="font-family: Courier New;">ACE_make_checked_array_iterator (PTR buf, size_t len)</span><br />
<span style="font-family: Courier New;">{</span><br />
<span style="font-family: Courier New;"> return stdext::checked_array_iterator  (buf, len);</span><br />
<span style="font-family: Courier New;">}</span><br />
<span style="font-family: Courier New;"># else</span><br />
<span style="font-family: Courier New;">template &lt;typename PTR&gt;<br />
</span><span style="font-family: Courier New;">PTR</span><br />
<span style="font-family: Courier New;">ACE_make_checked_array_iterator (PTR buf, size_t /* len */)</span><br />
<span style="font-family: Courier New;">{</span><br />
<span style="font-family: Courier New;"> // Checked iterators are unsupported. Just return the pointer to</span><br />
<span style="font-family: Courier New;"> // the buffer itself.</span><br />
<span style="font-family: Courier New;"> return buf;</span><br />
<span style="font-family: Courier New;">}</span><br />
<span style="font-family: Courier New;">#<br />
endif  /* _MSC_VER &gt;= 1400 */</span></p>
<p><span style="font-family: Courier New;">#endif<br />
/* ACE_CHECKED_ITERATOR_H */</span></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2010/06/ace-5-6-7-does-not-compile-with-stlport-in-win32-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compile 32bit C/C++ Application in 64bit Linux</title>
		<link>http://sudarsun.in/blog/2009/10/compile-32bit-cc-application-in-64bit-linux/</link>
		<comments>http://sudarsun.in/blog/2009/10/compile-32bit-cc-application-in-64bit-linux/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 12:59:19 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[KnowHow]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[-m32]]></category>
		<category><![CDATA[-m64]]></category>
		<category><![CDATA[32bit]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cross-compilation]]></category>
		<category><![CDATA[glibc]]></category>
		<category><![CDATA[libgcc]]></category>
		<category><![CDATA[libstdc++]]></category>
		<category><![CDATA[x64]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2009/10/compile-32bit-cc-application-in-64bit-linux/</guid>
		<description><![CDATA[To build (cross compilation) 32 bit C/C++ applications on 64 bit linux box, use &#8220;-m32&#8243; as a compiler argument.&#160; You would need the following 32bit libraries in place. Install glibc.i386, glibc-devel.i386 Install libgcc.i386 Install libstdc++.i386 #include &#60;cstdio&#62;#include &#60;iostream&#62;main(){&#160;&#160;&#160; std::cout &#60;&#60; &#8220;C++&#8221; &#60;&#60; std::endl;&#160;&#160;&#160; printf ( &#8220;long: %d\n&#8221;, sizeof(long) );&#160;&#160;&#160; printf ( &#8220;long long: %d\n&#8221;, sizeof(long [...]]]></description>
			<content:encoded><![CDATA[<p>To build (cross compilation) 32 bit C/C++ applications on 64 bit linux box, use &#8220;-m32&#8243; as a compiler argument.&nbsp; You would need the following 32bit libraries in place.
<ol>
<li>Install <b>glibc.i386</b>, <b>glibc-devel.i386</b></li>
<li>Install <b>libgcc.i386</b></li>
<li>Install <b>libstdc++.i386</b></li>
</ol>
<blockquote><p><font face="Courier New">#include &lt;cstdio&gt;<br />#include &lt;iostream&gt;<br />main()<br />{<br />&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &#8220;C++&#8221; &lt;&lt; std::endl;<br />&nbsp;&nbsp;&nbsp; printf ( &#8220;long: %d\n&#8221;, sizeof(long) );<br />&nbsp;&nbsp;&nbsp; printf ( &#8220;long long: %d\n&#8221;, sizeof(long long) );<br />&nbsp;&nbsp;&nbsp; return 0;<br />}</font></p></blockquote>
<blockquote><p><b>To compile in native 64bit:</b><br /><font color="#000066">[sudar@tstsrv12 tmp]</font>$ g++ <font color="#990000"><b>-m64</b></font> -o out64 code.cpp</p></blockquote>
<blockquote><p><font color="#000066">[sudar@tstsrv12 tmp]</font>$ ./out64<br />C++<br />long: 8<br />long long: 8</p></blockquote>
<blockquote><p><font color="#000066">[sudar@tstsrv12 tmp]</font>$ ldd out64<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; linux-vdso.so.1 =&gt;&nbsp; (0x00007fffc43fe000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libstdc++.so.6 =&gt; /usr/lib64/libstdc++.so.6 (0x0000003e7be00000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libm.so.6 =&gt; /lib64/libm.so.6 (0&#215;0000000000601000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libgcc_s.so.1 =&gt; /lib64/libgcc_s.so.1 (0x0000003e79e00000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libc.so.6 =&gt; /lib64/libc.so.6 (0&#215;0000000000886000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /lib64/ld-linux-x86-64.so.2 (0&#215;0000000000110000)</p></blockquote>
<p>
<blockquote><b>To compile in 32bit:</b><br /><font color="#000066">[sudar@tstsrv12 tmp]</font>$ g++ <font color="#990000"><b>-m32</b></font> -o out32 code.cpp</p></blockquote>
<p>
<blockquote><font color="#000066">[sudar@tstsrv12 tmp]</font>$ ./out32<br />C++<br />long: 4<br />long long: 8</p></blockquote>
<p>
<blockquote><font color="#000066">[sudar@tstsrv12 tmp]</font>$ ldd out32<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; linux-gate.so.1 =&gt;&nbsp; (0&#215;00130000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libstdc++.so.6 =&gt; /usr/lib/libstdc++.so.6 (0&#215;00133000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libm.so.6 =&gt; /lib/libm.so.6 (0&#215;00223000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libgcc_s.so.1 =&gt; /lib/libgcc_s.so.1 (0x0024c000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libc.so.6 =&gt; /lib/libc.so.6 (0x0025a000)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /lib/ld-linux.so.2 (0&#215;00110000)</p>
</blockquote>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=396b62b8-86bd-8f41-b78b-d1bc6fa538b1" /></div>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2009/10/compile-32bit-cc-application-in-64bit-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get MAC address using C++</title>
		<link>http://sudarsun.in/blog/2009/07/get-mac-address-using-c/</link>
		<comments>http://sudarsun.in/blog/2009/07/get-mac-address-using-c/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 12:18:43 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[random-numbers]]></category>
		<category><![CDATA[uuid]]></category>
		<category><![CDATA[uuidcreate]]></category>
		<category><![CDATA[UuidCreateSequential]]></category>
		<category><![CDATA[win32]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2009/07/get-mac-address-using-c/</guid>
		<description><![CDATA[There is a Simple way to capture the MAC address of the machine in Win32 environment. In Win32, UUID (version 1) uses MAC address &#38; timestamp as the seeds for generating the UUID.  In the UUID string, the last 6 bytes are the MAC address of the machine.  UuidCreateSequential() is the Win32 API which is [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">There is a Simple way to capture the MAC address of the machine in Win32 environment. In Win32, UUID (version 1) uses MAC address &amp; timestamp as the seeds for generating the UUID.  In the UUID string, the last 6 bytes are the MAC address of the machine.  <strong><a href="http://msdn.microsoft.com/en-us/library/aa379322%28VS.85%29.aspx" target="_blank">UuidCreateSequential()</a> </strong>is the Win32 API which is used to capture the MAC address via the UUID generated by it.</p>
<pre>#include &lt;rpc.h&gt;      // for UUID, UuidCreateSequential
#include &lt;cstring&gt;    // for memcpy
#include &lt;algorithm&gt;  // for std::swap

unsigned __int64
MACAddress( void ) const
{
    UUID u;
    ::UuidCreateSequential( &amp;u );

    u.Data4[0] = u.Data4[1] = 0;

    std::swap( u.Data4[0], u.Data4[7] );
    std::swap( u.Data4[1], u.Data4[6] );
    std::swap( u.Data4[2], u.Data4[5] );
    std::swap( u.Data4[3], u.Data4[4] );

    unsigned __int64 code;
    ::memcpy( &amp;code, &amp;u.Data4, sizeof(u.Data4) );

    return code;
}   // MACAddress</pre>
<p align="justify">Let me share another hack.  If you want to generate strings which do not repeat themselves, you could use <a href="http://msdn.microsoft.com/en-us/library/aa379205%28VS.85%29.aspx" target="_blank"><strong>UuidCreate()</strong></a> Win32 API, which generates unique UUIDs everytime the function is called.  The UUID thus obtained can be converted to a number or a string depending upon the need, which guarantees non-repeatable ids.</p>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2009/07/get-mac-address-using-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error: Can not start thread: error writing TLS. (error 87: the parameter is incorrect.)</title>
		<link>http://sudarsun.in/blog/2009/02/error-can-not-start-thread-error-writing-tls-error-87-the-parameter-is-incorrect/</link>
		<comments>http://sudarsun.in/blog/2009/02/error-can-not-start-thread-error-writing-tls-error-87-the-parameter-is-incorrect/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 08:56:42 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[KnowHow]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[wxwidgets]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2009/02/error-can-not-start-thread-error-writing-tls-error-87-the-parameter-is-incorrect/</guid>
		<description><![CDATA[When I tried building an multi-thread TUI application using wxWidgets framework, I got the following error while executing the application. Error: Can not start thread: error writing TLS. (error 87: the parameter is incorrect.) I was not able to reason out this behavior. I tried changing between THREAD_DETACHABLE and THREAD_JOINABLE, but was not able to [...]]]></description>
			<content:encoded><![CDATA[<p>When I tried building an multi-thread TUI application using wxWidgets framework, I got the following error while executing the application.</p>
<blockquote><p>Error: Can not start thread: error writing TLS. (error 87: the parameter is incorrect.)</p></blockquote>
<p>I was not able to reason out this behavior. I tried changing between THREAD_DETACHABLE and THREAD_JOINABLE, but was not able to get through.&nbsp; When I search for hints from the web, I got the following link.</p>
<p><a href="http://osdir.com/ml/lib.wxwindows.general/2004-01/msg00759.html">http://osdir.com/ml/lib.wxwindows.general/2004-01/msg00759.html</a></p>
<p>It was advised to create a dummy wxInitializer object so that the wxWidgets platform does the necessary initialization.&nbsp; wxInitializer class is an undocumented class and called internally when a wxFrame or wxDialog based GUI application is built.&nbsp; Typically, wxInitializer object is instantiated internally by the wxApp class.&nbsp; Since, in my application there is no wxApp object which led to the above problem</p>
<p>When I dug the declaration of wxInitializer class, I found it declared at wx/init.h;&nbsp; Also I found that instead of instantiating the object, we may call the following function.</p>
<blockquote><p>extern bool WXDLLIMPEXP_BASE wxInitialize(int argc = 0, wxChar **argv = NULL);</p></blockquote>
<p>In my application, I did the following:</p>
<blockquote><p>main( int argc, char **argv )<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; extern bool wxInitialize( int, char ** );<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wxInitialize( argc, argv );<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8230;.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8230;.<br />}</p></blockquote>
<p>It worked like piece of cream.</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=1c3a5b7e-1fa0-4621-bef5-009a6ba89852" /></div>
<p class="scribefire-powered">Powered by <a href="http://www.scribefire.com/">ScribeFire</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2009/02/error-can-not-start-thread-error-writing-tls-error-87-the-parameter-is-incorrect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FFTW library under Windows Mobile 6 Standard SDK</title>
		<link>http://sudarsun.in/blog/2008/09/fftw-library-under-windows-mobile-6-standard-sdk/</link>
		<comments>http://sudarsun.in/blog/2008/09/fftw-library-under-windows-mobile-6-standard-sdk/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 10:07:42 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[fft]]></category>
		<category><![CDATA[fftw]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2008/09/fftw-library-under-windows-mobile-6-standard-sdk/</guid>
		<description><![CDATA[FFT (Fast Fourier Transform) is a technique by which one can perform 1D and 2D transforms on discrete data. Typically Discrete Fourier Transform is the primary application of FFT. One implementation of FFT is available at www.fftw.org. FFTW is currently available for multiple platforms including Windows and Linux. I was looking for a framework to [...]]]></description>
			<content:encoded><![CDATA[<p>FFT (Fast Fourier Transform) is a technique by which one can perform 1D and 2D transforms on discrete data.  Typically Discrete Fourier Transform is the primary application of FFT.  One implementation of FFT is available at <a target="_blank" href="http://www.fftw.org">www.fftw.org</a>.  FFTW is currently available for multiple platforms including Windows and Linux.</p>
<p>I was looking for a framework to run FFT operation on a Windows Mobile 6 platform in native C++. Unfortunately, there are none.  So, I decided to port the framework myself and indeed I was successful too.  I have placed the framework at <a href="http://www.sudarsun.in/downloads/FFTW-3.0.1-ARMV4I.zip">www.sudarsun.in/</a><wbr /><a href="http://www.sudarsun.in/downloads/FFTW-3.0.1-ARMV4I.zip">downloads/FFTW-3.0.1-ARMV4I.</a><wbr /><a href="http://www.sudarsun.in/downloads/FFTW-3.0.1-ARMV4I.zip">zip</a>. It does not contain any documentation.  I shall update it ASAP.</p>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2008/09/fftw-library-under-windows-mobile-6-standard-sdk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linker Error while compiling wxWidgets application in Visual Studio 6</title>
		<link>http://sudarsun.in/blog/2008/07/linker-error-while-compiling-wxwidgets-application-in-visual-studio-6/</link>
		<comments>http://sudarsun.in/blog/2008/07/linker-error-while-compiling-wxwidgets-application-in-visual-studio-6/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 17:28:28 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Help]]></category>
		<category><![CDATA[KnowHow]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[linker error]]></category>
		<category><![CDATA[vs6]]></category>
		<category><![CDATA[wxwidgets]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/?p=17</guid>
		<description><![CDATA[&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;Configuration: SVDui &#8211; Win32 Debug&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; Linking&#8230; wxmsw28d_core.lib(app.obj) : error LNK2001: unresolved external symbol __imp__InitCommonControls@0 wxmsw28d_core.lib(spinbutt.obj) : error LNK2001: unresolved external symbol __imp__CreateUpDownControl@48 wxmsw28d_core.lib(statbr95.obj) : error LNK2001: unresolved external symbol __imp__CreateStatusWindowA@16 wxmsw28d_core.lib(listctrl.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIconSize@12 wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIconSize@12 wxmsw28d_core.lib(listctrl.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Draw@24 wxmsw28d_core.lib(imaglist.obj) [...]]]></description>
			<content:encoded><![CDATA[<div class="content-wrapper"><font face="Courier New, Courier, mono">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;Configuration: SVDui &#8211; Win32 Debug&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; <br />Linking&#8230; <br />wxmsw28d_core.lib(app.obj) : error LNK2001: unresolved external symbol __imp__InitCommonControls@0 <br />wxmsw28d_core.lib(spinbutt.obj) : error LNK2001: unresolved external symbol __imp__CreateUpDownControl@48 <br />wxmsw28d_core.lib(statbr95.obj) : error LNK2001: unresolved external symbol __imp__CreateStatusWindowA@16 <br />wxmsw28d_core.lib(listctrl.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIconSize@12 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIconSize@12 <br />wxmsw28d_core.lib(listctrl.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Draw@24 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Draw@24 <br />wxmsw28d_core.lib(listctrl.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetImageCount@4 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetImageCount@4 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Create@20 <br />wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Create@20 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Destroy@4 <br />wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Destroy@4 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Add@12 <br />wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Add@12 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_AddMasked@12 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_ReplaceIcon@12 <br />wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_ReplaceIcon@12 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Replace@16 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_Remove@8 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_SetBkColor@8 <br />wxmsw28d_core.lib(imaglist.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIcon@12 <br />wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_SetDragCursorImage@16 <br />wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_BeginDrag@16 <br />wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_EndDrag@0 <br />wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_DragMove@8 <br />wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_DragEnter@12 <br />wxmsw28d_core.lib(dragimag.obj) : error LNK2001: unresolved external symbol __imp__ImageList_DragLeave@4 <br />wxmsw28d_core.lib(uuid.obj) : error LNK2001: unresolved external symbol __imp__UuidToStringA@8 <br />wxmsw28d_core.lib(uuid.obj) : error LNK2001: unresolved external symbol __imp__RpcStringFreeA@4 <br />wxmsw28d_core.lib(uuid.obj) : error LNK2001: unresolved external symbol __imp__UuidCreate@4 <br />wxmsw28d_core.lib(uuid.obj) : error LNK2001: unresolved external symbol __imp__UuidFromStringA@8 <br />Debug/SVDui.exe : fatal error LNK1120: 25 unresolved externals <br />Error executing link.exe. </p>
<p>SVDui.exe &#8211; 33 error(s), 0 warning(s)</font> <br /> 
<p align="justify">The solution to the above problem is to add &#8220;<strong>rpcrt.lib comctl32.lib</strong>&#8221; at <em><strong>project settings-&gt;Link-&gt;object/library modules</strong></em><br />
along with &#8220;kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib<br />
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib<br />
odbccp32.lib&#8221;.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2008/07/linker-error-while-compiling-wxwidgets-application-in-visual-studio-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  sudarsun.in/blog/tag/c/feed/ ) in 0.42566 seconds, on Feb 7th, 2012 at 4:14 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 7th, 2012 at 5:14 pm UTC -->
