<?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>Eric&#039;s Who Know &#187; Code::Blocks</title> <atom:link href="http://who-know.com/tag/codeblocks/feed/" rel="self" type="application/rss+xml" /><link>http://who-know.com</link> <description>C&#039;est La Vie</description> <lastBuildDate>Mon, 17 May 2010 22:21:05 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Code::Blocks 教學 &#8211; Debugging</title><link>http://who-know.com/how-to-debug-with-codeblocks/</link> <comments>http://who-know.com/how-to-debug-with-codeblocks/#comments</comments> <pubDate>Wed, 03 Feb 2010 19:01:32 +0000</pubDate> <dc:creator>Eric</dc:creator> <category><![CDATA[Free Teaching]]></category> <category><![CDATA[Code::Blocks]]></category> <category><![CDATA[Debug]]></category> <category><![CDATA[GNU]]></category><guid isPermaLink="false">http://who-know.com/?p=96</guid> <description><![CDATA[01. File -> New -> Project -> Console application -> Go -> C/C++ -> 打上 Project title 和選擇要存放的位置 -> Next -> Finish
// 不要懶的創 Project，就 File -> New -> File -> C/C++ source -> Go -> C/C++ -> ...
// 或更偷懶直接，就 File -> Empty file
// 因為這樣會不能使用 Debug 功能
02. 點左邊 Projects 下的 Workspace -> Project title -> Sources [...]]]></description> <content:encoded><![CDATA[<p>01. File -> New -> Project -> Console application -> Go -> C/C++ -> 打上 Project title 和選擇要存放的位置 -> Next -> Finish</p><p>// 不要懶的創 Project，就 File -> New -> File -> C/C++ source -> Go -> C/C++ -> ...<br /> // 或更偷懶直接，就 File -> Empty file<br /> // 因為這樣會不能使用 Debug 功能</p><p>02. 點左邊 Projects 下的 Workspace -> Project title -> Sources -> *.cpp，貼上下面的程式碼，來體驗一下 Code::Blocks 的 Debug 功能。<span id="more-96"></span></p><pre class="brush: cpp;">
# include &lt;iostream&gt;
# define SIZE  10

using namespace std;

int main( ) {

  int test[ SIZE ] = { 0 };

  for ( int i = 0; i &lt; SIZE; i++ ) {
    test[ i ] = i;
  }

  system( &quot;PAUSE&quot; );
  return 0;
}
</pre><p>03. <a href="http://www.codeblocks.org/" target="_blank">Code::Blocks</a> Debug 三部曲</p><p>a. Build target 切換到 Debug</p><p>b. Settings -> Compiler and debugger -> Produce debugging symbols [-g] 打勾</p><p>c. 新增中斷點 : 在 test[ i ] = i; 那行，行號的右邊空白按左鍵( or 右鍵 -> Add breakpoint )</p><p>04. 上面都設定好後，按下 F8 or IDE 上的圖示( Debug / Continue ) 就可以開始 Debug 了。<br /> // Watches、Disassembly、Call Stack、Memory、CPU Registers 等，都可以在 Debug -> Debugging windows 下找到</p><p><a href="http://pic.who-know.com/CodeBlocks/007.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/007.png" alt="" width="460" height="280"/></a></p><p>05. 照上面設定還是不能 Debug 的話</p><p>a. Build target : Debug</p><p>b. 檢查 Settings -> Compiler and debugger -> Produce debugging symbols [-g] 是否有打勾 ( 要打勾 )<br /> // 特徵 : ( no debugging symbols found )</p><p>d. 檢查 Settings -> Compiler and debugger -> Strip all symbols from binarry ( minimizes size ) [-s] 是否有打勾 ( 不要打勾 )<br /> // 特徵 : ( no debugging symbols found )</p><p>c. 檢查是否有 gdb.exe</p><p>// 可以到 ( <a href="http://sourceforge.net/projects/mingw/files/" target="_blank">The GNU Project Debugger</a> ) 點 GNU Source-Level Debugger 下載<br /> // 可以到 ( <a href="http://prdownloads.sf.net/mingw/gdb-6.3-2.exe" target="_blank">The GNU Project Debugger</a> ) 下載</p> ]]></content:encoded> <wfw:commentRss>http://who-know.com/how-to-debug-with-codeblocks/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Windows C++ IDE 教學 &#8211; C++ Socket Programming</title><link>http://who-know.com/windows-c-ide-c-socket-programming/</link> <comments>http://who-know.com/windows-c-ide-c-socket-programming/#comments</comments> <pubDate>Mon, 01 Feb 2010 10:42:48 +0000</pubDate> <dc:creator>Eric</dc:creator> <category><![CDATA[Free Teaching]]></category> <category><![CDATA[C++ IDE]]></category> <category><![CDATA[Code::Blocks]]></category> <category><![CDATA[Socket]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[WinSock]]></category><guid isPermaLink="false">http://who-know.com/?p=94</guid> <description><![CDATA[01. 使用 Code::Blocks 寫 Socket Program 的設定
Settings -> Compiler and debugger -> Linker Settings -> Other linker options -> 加上 -lws2_3202. 使用 Dev C++ 寫 Socket Program 的設定
Tools -> Compiler Options -> 打勾 Add these commands to linker command line -> 加上 -lws2_3203. 使用 Microsoft Visual C++ 6.0 寫 Socket Program 的設定。// 以下方法擇一即可
a. 程式碼前面加上 #pragma [...]]]></description> <content:encoded><![CDATA[<p>01. 使用 <a href="http://www.codeblocks.org/" target="_blank">Code::Blocks</a> 寫 Socket Program 的設定</p><p>Settings -> Compiler and debugger -> Linker Settings -> Other linker options -> 加上 -lws2_32<span id="more-94"></span></p><p><a href="http://pic.who-know.com/CodeBlocks/001.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/001.png" alt="" width="480" height="430"/></a></p><p>02. 使用 <a href="http://www.bloodshed.net/devcpp.html" target="_blank">Dev C++</a> 寫 Socket Program 的設定</p><p>Tools -> Compiler Options -> 打勾 Add these commands to linker command line -> 加上 -lws2_32</p><p><a href="http://pic.who-know.com/CodeBlocks/002.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/002.png" alt="" width="480" height="430"/></a></p><p>03. 使用 Microsoft Visual C++ 6.0 寫 Socket Program 的設定。// 以下方法擇一即可</p><p>a. 程式碼前面加上 #pragma comment(lib, "wsock32.lib")</p><p>b. Project -> Settings -> Link -> Object/library modules -> 最後加上 ws2_32.lib</p><p><a href="http://pic.who-know.com/CodeBlocks/003.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/003.png" alt="" width="480" height="340"/></a></p> ]]></content:encoded> <wfw:commentRss>http://who-know.com/windows-c-ide-c-socket-programming/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Windows C++ IDE 教學 &#8211; Increase Stack Size</title><link>http://who-know.com/windows-c-ide-tutorial-how-to-increase-stack-size/</link> <comments>http://who-know.com/windows-c-ide-tutorial-how-to-increase-stack-size/#comments</comments> <pubDate>Sun, 31 Jan 2010 18:01:06 +0000</pubDate> <dc:creator>Eric</dc:creator> <category><![CDATA[Free Teaching]]></category> <category><![CDATA[C++ IDE]]></category> <category><![CDATA[Code::Blocks]]></category> <category><![CDATA[Stack]]></category> <category><![CDATA[Windows]]></category><guid isPermaLink="false">http://who-know.com/?p=95</guid> <description><![CDATA[01. Code::Blocks 之 Increase Stack Size 的方法
Settings -> Compiler and debugger -> Linker Settings -> Other linker options -> 加上 -Wl,-stack,填需要的大小
// eg : -Wl,-stack,5000000002. Dev C++ 之 Increase Stack Size 的方法
Tools -> Compiler Options -> 打勾 Add these commands to linker command line -> 加上 -Wl,-stack,填需要的大小
// eg : -Wl,-stack,5000000003. Microsoft Visual C++ 6.0 之 Increase [...]]]></description> <content:encoded><![CDATA[<p>01. <a href="http://www.codeblocks.org/" target="_blank">Code::Blocks</a> 之 Increase Stack Size 的方法</p><p>Settings -> Compiler and debugger -> Linker Settings -> Other linker options -> 加上 -Wl,-stack,填需要的大小<br /> // eg : -Wl,-stack,50000000<span id="more-95"></span></p><p><a href="http://pic.who-know.com/CodeBlocks/004.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/004.png" alt="" width="480" height="430"/></a></p><p>02. <a href="http://www.bloodshed.net/devcpp.html" target="_blank">Dev C++</a> 之 Increase Stack Size 的方法</p><p>Tools -> Compiler Options -> 打勾 Add these commands to linker command line -> 加上 -Wl,-stack,填需要的大小<br /> // eg : -Wl,-stack,50000000</p><p><a href="http://pic.who-know.com/CodeBlocks/005.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/005.png" alt="" width="480" height="430"/></a></p><p>03. Microsoft Visual C++ 6.0 之 Increase Stack Size 的方法</p><p>Project -> Settings -> Link -> Category -> Output -> Stack allocations -> Reserve -> 填需要的大小<br /> // Max : 4,294,967,295 bytes；可以填 10 or 16 進位；單位為 byte；Commit 可以不填。<br /> // eg : 填 50000000 = 填 0x2faf080</p><p><a href="http://pic.who-know.com/CodeBlocks/006.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/CodeBlocks/006.png" alt="" width="480" height="340"/></a></p><p>04. Sample Code</p><pre class="brush: cpp;">
# include &lt;iostream&gt;
# define SIZE  12345678

using namespace std;

int main( ) {
  int test[ SIZE ] = { 0 };

  for ( int i = 0; i &lt; SIZE; i++ ) {
    test[ i ] = i;
  }

  cout &lt;&lt; test[ SIZE - 1 ] &lt;&lt; &quot;\nWho-Know.Com&quot; &lt;&lt; endl;
  cout &lt;&lt; SIZE * sizeof( int ) &lt;&lt; &quot; bytes&quot; &lt;&lt; endl;
  cout &lt;&lt; sizeof( test ) &lt;&lt; &quot; bytes&quot; &lt;&lt; endl;

  system( &quot;PAUSE&quot; );
  return 0;
}
</pre><p>Ref :<br /> 01. <a href="http://msdn.microsoft.com/en-us/library/8cxs58a6(VS.71).aspx" target="_blank">/STACK (Stack Allocations)</a></p> ]]></content:encoded> <wfw:commentRss>http://who-know.com/windows-c-ide-tutorial-how-to-increase-stack-size/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>