顯示具有 win32 標籤的文章。 顯示所有文章
顯示具有 win32 標籤的文章。 顯示所有文章

2011年3月21日 星期一

[學習筆記] c++的影像處理 - 使用CImg Library

The CImg Library官網:http://cimg.sourceforge.net/
下載網址:http://sourceforge.net/projects/cimg/files/
說明文件(英文):http://cimg.sourceforge.net/CImg_reference.pdf
說明文件(簡體中文):http://cimg.sourceforge.net/CImg_reference_chinese.pdf

Code Block的設定:

  • Settings -> Compiler and Debugger -> Search Directories -> 新增[CImg的目錄]
  • Settings -> Compiler and Debugger -> Linker Settings -> 新增 libgdi32.a

(若沒設定libdgi32.a會出現compiler error: SetDIBitsToDevice@48)

Visual C++ 設定 (版本:2008 Express Edition):

  • Tools -> Options -> Projects and Solutions -> VC++ Directories -> Show directories for -> Include files -> 新增[CImg的目錄]

範列程式碼 (CImg Library官方文件)

2011年3月17日 星期四

[學習筆記] MinGW + Code Block + pdcurses

Step 1: 安裝Code Blocks with MinGW
下載網址:http://www.codeblocks.org/downloads

Step 2: 下載 pdcurses
網址:http://pdcurses.sourceforge.net/
至下載頁面下載檔案: pdc34dllw.zip (目前看到的最新版)

解壓縮到硬碟目錄
(我是解壓縮到 C:\pdc34dllw )

Step 3: 執行Code Blocks並設定
Settings -> Compiler and Debugger -> Link Seetings
加入檔案: C:\pdc34dllw\pdcurses.lib

Settings -> Compiler and Debugger -> Search Directories
加入目錄 C:\pdc34dllw 至 「Compiler」、「Linker」、「Resource compiler」

Step4: 建立一個新的 Console application project


程式碼測試 (test.cpp):
#include <curses.h>

int main()
{
    initscr(); /* curses模式開始 */
    printw("Hello World!!"); /*印出Hello World!!*/
    refresh(); /*將字串在螢幕上印出*/
    getch(); /*等待輸入指令*/
    endwin(); /*結束curses模式*/
    return 0;
}


Compile方法:
執行 Build->Build
把 C:\pdc34dllw\pdcurses.dll 複制到 "\debug" 或 "\release" 資料夾內
執行 Build->Run
就可以不看見測試的結果
螢幕上會出現Hello World!!的字,然後只要按下任意鍵就會結束程式(視窗)