精華區beta b865060xx 關於我們 聯絡資訊
※ [本文轉錄自 b885060xx 看板] 作者: smartboy (小光光) 看板: b885060xx 標題: 介紹一個寫C/C++程式的軟體 時間: Wed Sep 29 09:52:38 1999 作者: smartboy (小光光) 看板: CK51st316 標題: 介紹一個寫C/C++程式的軟體 時間: Fri Jul 23 12:51:28 1999 有時會有同學問我學寫程式的問題, 常會問到哪裡有可以用來寫 C/C++ 程式的軟體(編譯器, compiler), 我會說網路上有免費的, 不過通常大部分的人恐帕都沒有興趣慢慢摸索網路上有什麼免費 的編譯器該抓那些檔案該如何安裝. 在這裡我非常簡單的介紹 DJGPP 給大家. * 在這段我盡量不用到一些專有名詞, 目的讓大家能夠很簡單的 把軟體抓回家, 安裝好, 能夠寫程式就行了 我假設你的環境是 Windows (95or98, NT我沒試過), 你知道如何操作瀏覽器, WINZIP 1.開啟瀏覽器, 網址填 http://www.ck.tp.edu.tw/~kcwu/djgppnom.zip 用 28.8K 以上的數據機約需四五Q分鐘的下載時間 2.把 djgppnom.zip 解開到 c:\ (使用支援長檔名的zip解壓縮程式, 如果不知道的話, 用 WINZIP 就可以了) (djgppnom.zip約占硬碟空間 8.5MB, 解開來約占 20MB) 3.在 c:\autoexec.bat 最後面加上這兩行 set djgpp=c:\djgpp\djgpp.env path c:\djgpp\bin;%path% 4.重新開機後, 只要輸入 rhide, 就可以開始寫程式了 操作方式很類似 Turbo C++, 有的書上有介紹 TC, 如果你沒用過, 你可能要自己玩玩看. 選單中可以找到各種功能. C 程式記得存檔副檔名 .c, C++ 則是 .cpp 程式寫好可以按 CTRL-F9 執行, 按 ALT-F5 看執行結果 5.試著寫個簡單的程式確定可以使用吧:) * 更進一步的介紹 DJGPP 是 gun c/c++ compiler(gcc) 移殖到 dos(windows) 環境的軟體, 使用 DJGPP 一些特點 -> 它是一個 32-bit 的 compiler, 且編譯出來的執行檔效率(最佳化)不錯 -> 不再有 DOS 640k 的記憶體限制 -> 他可以營造一個模擬 UNIX 的環境, 除了有 bash 及一票 UNIX 工具 可用, 寫的程式也滿容易移植到 UNIX 上 -> DJGPP 的 C compiler 符合 ANSI/ISO C 標準 -> DJGPP 的 C++ compiler 支援滿新的 C++ 標準(我不確定支援到什麼程度) DJGPP 有許多程式可選擇性安裝, 前面講的 djgppnom.zip 是我 挑選寫 C/C++ 程式所需的基本安裝, 再加上 rhide 整合開發環境, 我自己在用的則安裝了比較多的軟體, 不見得大家都會需要就是了 有興趣的可以到 http://163.13.180.5/~kcwu/ DJGPP 主要核心(djdev)已經到 2.02 版了, 我現在在用的是 2.01 * 更進一步的資訊可以參考 http://www.delorie.com/djgpp http://www.delorie.com/djgpp/v2faq/faq.html * 摘錄 FAQ 中 What is DJGPP 的部分內容 **Q*: What is DJGPP?* *A*: DJGPP is a compiler and a set of tools that let you produce 32-bit protected-mode programs which run on MS-DOS/MS-Windows machines. The originator and principal maintainer of DJGPP is DJ Delorie <dj@delorie.com>; that's where the "DJ" in "DJGPP" comes from. However, anybody is welcome and encouraged to contribute. Programs compiled with DJGPP, and all development tools provided as part of DJGPP, look on the outside like normal DOS programs, and they rely on MS-DOS and BIOS for file I/O and other basic functions such as keyboard input, screen cursor position, etc. DJGPP programs use "DPMI" (the DOS Protected Mode Interface) to allow DOS/BIOS calls from protected mode. Therefore, any environment that can run DOS programs and provides DPMI services, will run DJGPP programs as well. Environments that are known to be compatible with DJGPP include MS-DOS, DR-DOS, NWDOS, FreeDOS, OpenDOS, Windows 3.X, 9X and NT, OS/2, and Linux DOSEmu. When DJGPP programs run on Windows 9X, they support long filenames. Programs compiled with DJGPP can access all the physical memory on your machine and support virtual memory. All this memory presents a flat address space with no segmentation (you can say goodbye to far and huge pointers and to memory models), and is only limited by the amount of virtual memory supported by the DPMI server in use. A typical DPMI server can provide at least 64MB of virtual memory (if you have enough free disk space). DJGPP is free: you don't have to pay anything to download and use it, even if you write commercial programs. DJGPP doesn't impose any restrictions on programs that you write and compile with it: you can make them commercial, shareware, freeware, or any other kind. (There are a few minor exceptions to that rule, see (un)restrictions on distribution of DJGPP apps in Application distribution.) The core of DJGPP is the MS-DOS port of the GNU C/C++ compiler, GCC, and auxiliary utilities, such as assembler, linker, librarian, Make, and a hypertext docs browser. The DJGPP C library was written specifically for DJGPP, mainly by DJ Delorie himself, with help from a small group of volunteers. DJGPP presents a set of tools which are remarkably ANSI- and Posix-compliant(1). GCC complies to ANSI/ISO C Standard; the DJGPP C library is ANSI- and Posix-compliant (however, a small number of Posix features, like the `fork' system call, are unimplemented); the C++ libraries also comply to the latest standards; and the GNU development tools used by DJGPP are all Posix-compliant. As a result, DJGPP tools provide a complete and coherent Posix layer on top of Microsoft operating systems, to the degree that even the infamous limitations of DOS and incompatibilities between DOS/Windows and Unix are almost completely concealed from users and developers. Here are some of the tasks that DJGPP is said to be good for: - learning C and C++ programming and teaching others to program in C/C++; - using Unix development tools on MS-DOS and MS-Windows; - writing games(2) and graphics programs; - setting up a common development environment for Unix and MS-DOS/MS-Windows; - writing portable DOS/Unix programs; - porting Unix programs to Microsoft operating systems. -- ※ 發信站: 批踢踢實業坊(ptt.twbbs.org) ◆ From: nlpc15.csie.ntu -- 所謂系統是指任何沒有系統的東西, 硬體是指當您讓它掉到地上時會發出聲音的東西, 而軟體則是當它無法運作時卻找不出合理解釋的事物。 - Johannes Leckebusch - -- ※ 發信站: 批踢踢實業坊(ptt.twbbs.org) ◆ From: ntucsa.csie.ntu > -------------------------------------------------------------------------- < 作者: Lworm (找不到藉口...) 看板: b865060xx 標題: 關於上一篇 時間: Thu Sep 30 22:51:09 1999 剛好昨天楊神跟我說到 DJGPP, 今天 b88 版上 smartboy 就介紹啦:p 很棒的軟體,我也是最近才知道^^; 特別轉錄過來,好東西大家用:) http://www.delorie.com/djgpp/ -- 呃,不會全世界都早就知道了吧?:p chen: 哼,這個我三個月前就知道了! -- 所謂系統是指任何沒有系統的東西, 硬體是指當您讓它掉到地上時會發出聲音的東西, 而軟體則是當它無法運作時卻找不出合理解釋的事物。 - Johannes Leckebusch - -- ※ 發信站: 批踢踢實業坊(ptt.twbbs.org) ◆ From: ntucsa.csie.ntu > -------------------------------------------------------------------------- < 作者: curt (要來打球歐 :)) 看板: b865060xx 標題: Re: 關於上上一篇(死curt...-_-) 時間: Thu Sep 30 22:57:40 1999 什麼標題嘛 :~ -- 救命啊!!!我要睡了!!! -- ※ 發信站: 批踢踢實業坊(ptt.twbbs.org) ◆ From: m3317_2.m3.ntu. > -------------------------------------------------------------------------- < 作者: Lworm (找不到藉口...) 看板: b865060xx 標題: Re: 關於上上一篇(死curt...-_-) 時間: Thu Sep 30 23:00:09 1999 ※ 引述《curt (要來打球歐 :))》之銘言: : 什麼標題嘛 :~ 哼哼,原本想說三篇放在一起的, 沒想到你這可惡的烏龜就忽然冒出一篇 -_- -- 所謂系統是指任何沒有系統的東西, 硬體是指當您讓它掉到地上時會發出聲音的東西, 而軟體則是當它無法運作時卻找不出合理解釋的事物。 - Johannes Leckebusch - -- ※ 發信站: 批踢踢實業坊(ptt.twbbs.org) ◆ From: ntucsa.csie.ntu > -------------------------------------------------------------------------- < 作者: DeanL (無常) 看板: b865060xx 標題: Re: 關於上上一篇(死curt...-_-) 時間: Fri Oct 1 07:58:29 1999 ※ 引述《Lworm (找不到藉口...)》之銘言: : 剛好昨天楊神跟我說到 DJGPP, : 今天 b88 版上 smartboy 就介紹啦:p : 很棒的軟體,我也是最近才知道^^; : 特別轉錄過來,好東西大家用:) : http://www.delorie.com/djgpp/ 可是在NT下玩的話,就會用到cmd mode,就會被迫執行惡名昭彰的 NTVDM...很慢很慢...... sigh.... 還是只能用VC -- 藝術如同科學,不講細節就沒有樂趣 In art, as in science, there is no delight without details --- Carlos Liu 程式設計如同藝術,不求創作就沒有價值 In programming, as in art, there is no value without creativities --- Dean Liao -- ※ 發信站: 批踢踢實業坊(ptt.twbbs.org) ◆ From: deanl.m3.ntu.ed > -------------------------------------------------------------------------- < 作者: DickG (龍龍) 看板: b865060xx 標題: Re: 關於上上一篇(死curt...-_-) 時間: Fri Oct 1 11:58:51 1999 ※ 引述《Lworm (找不到藉口...)》之銘言: : 剛好昨天楊神跟我說到 DJGPP, : 今天 b88 版上 smartboy 就介紹啦:p : 很棒的軟體,我也是最近才知道^^; : 特別轉錄過來,好東西大家用:) : http://www.delorie.com/djgpp/ ^>^ 我這有一系列有關 djgpp 的介紹,包括各個 libs 和要寫 game 的 lib 的使用及安裝等等(高中時很迷 game programming 而收集的), 記得在台大電機的 programming 版的精華區有很多這方面的 doc anyway...的確是個很不錯的工具...不過要花不少時間才能將它的 power 挖出來(即詳加了解支援它的 libs) 懶懶的我現在都是用 vc ,且也只用到一些簡單的 OO ^>^... 龍龍 -- 你是一位聰明人嗎?如果是,你該記住,你的聰明是跟那些人學來的, 然後在適當的地點,適當的時間,輕輕的對那人說:這是你教我的。 聲音要輕,而且只告訴他一個人。 摘錄自"牧羊少年奇幻之旅" -- ※ 發信站: 批踢踢實業坊(ptt.twbbs.org) ◆ From: DickG.m5.ntu.ed > -------------------------------------------------------------------------- < 作者: Lworm (找不到藉口...) 看板: b865060xx 標題: Re: 關於上上一篇(死curt...-_-) 時間: Fri Oct 1 20:21:54 1999 ※ 引述《DeanL (無常)》之銘言: : ※ 引述《Lworm (找不到藉口...)》之銘言: : : 剛好昨天楊神跟我說到 DJGPP, : : 今天 b88 版上 smartboy 就介紹啦:p : : 很棒的軟體,我也是最近才知道^^; : : 特別轉錄過來,好東西大家用:) : : http://www.delorie.com/djgpp/ : 可是在NT下玩的話,就會用到cmd mode,就會被迫執行惡名昭彰的 : NTVDM...很慢很慢...... ^^^^^ 這個是?^^; : sigh.... 還是只能用VC -- 所謂系統是指任何沒有系統的東西, 硬體是指當您讓它掉到地上時會發出聲音的東西, 而軟體則是當它無法運作時卻找不出合理解釋的事物。 - Johannes Leckebusch - -- ※ 發信站: 批踢踢實業坊(ptt.twbbs.org) ◆ From: ntucsa.csie.ntu