2008-04-04
转载:安裝 Cygwin 配合 NetBeans 編輯 C/C++
安裝 Cygwin 配合 NetBeans 編輯 C/C++
在 NetBeans 中,我們要編輯 C/C++ 除了要安裝 Plugin 外,還要安裝 C/C++ Compiler。
下方的例子是使用 Cygwin 和 NetBeans 來達成我們的需求:
首先,當然是安裝 Cygwin ( Windows 平台上的一種 Unix 環境 )
網址:http://www.cygwin.com/
點擊,如下方的圖示下載安裝檔
請選擇下一步
這邊我們使用從網路安裝 (預設)
若干的設定如下圖,大部份的人比較會動到安裝的位置
在這裡我安裝在 d:" cygwin下方:
接著給他一個,放置下載檔案的位置:
選擇連結到網路的方式
設定從那邊下載檔案,要選好自己國家或是速度較快的位置
不然你可能要等上老半天......
等待他下載安裝的資訊。
選擇要安裝的 packages
在這邊我把右上的 view 點至切換成 Full 來檢視 packages
這樣,我們可以依字母的排列來找到要安裝的 package 及說明
如下圖:
然後,我們安裝需要用到的四個 package 就好
分別是 gdb 、 gcc-core 、 gcc-c++ 、 make ,如下圖所示:
選好之後,按下一步並等待安裝結束。
要不要放 link 就因個人習慣囉.....
之後在環境變數中設置
CYGWIN_HOME 為安裝的目錄,在這邊是 D:"cygwin
PATH 加入,%CYGWIN_HOME%"bin,原本有的內容要以 ; 串接哦!
設好了之後到 NetBeans 中選 Tools ---> Plugin
讓我們在可安裝的 Plugins 中選擇 C/C++,並按 Install
按 Next
選 I accept ....... , 並按 Install
等待下載及安裝過程
顯示安裝 plugin 完成
如下圖,我們就可以在 new project 中看到 C/C++
相關的種類:
我們在建立的 Project 中的 Properties 中可以看到
GNU Complier Collection from Cygwin , 如下圖:
視需要 ( 如在用 JNI 時 ),記得要設定 Complier 中的 Command Line
-mno-cygwin -Wl,--add-stdcall-alias -shared -m32
如下圖
上方,參數的意義如下:
The -mno-cygwin option, enables building DLLs that have no dependencies on Cygwin own libraries and thus can be executed on machines which do not have Cygwin installed.
The -Wl,--add-stdcall-alias passes the --add-stdcall-alias option to the linker; without it, the resulting application would fail with the UnsatisfiedLinkError.
The -shared option tells the compiler to generate a DLL ( not an executable file).
-m32 tells the compiler to create a 32-bit binary. On 64-bit systems the compiled binaries are 64-bit by default , which causes a lot of problems with 32-bit JDKs.
參數的意義截自 http://www.netbeans.org/kb/55/beginning-jni-part1.html
----------------------------------------------------------------------------------
以上如有錯誤,歡迎告知改正
@font-face{ font-family:"Times New Roman"; } @font-face{ font-family:"宋体"; } @font-face{ font-family:"Symbol"; } @font-face{ font-family:"Arial"; } @font-face{ font-family:"黑体"; } @font-face{ font-family:"Courier New"; } @font-face{ font-family:"Wingdings"; } @font-face{ font-family:"Courier New CYR"; } p.0{ margin:0pt; margin-bottom:0.0001pt; layout-grid-mode:char; text-align:justify; font-size:10.5000pt; font-family:'Times New Roman'; } @page{}@page Section0{ margin-top:72.0000pt; margin-bottom:72.0000pt; margin-left:90.0000pt; margin-right:90.0000pt; size:595.3000pt 841.9000pt; layout-grid:15.6000pt; } div.Section0{page:Section0;}
下方的例子是使用 Cygwin 和 NetBeans 來達成我們的需求:
首先,當然是安裝 Cygwin ( Windows 平台上的一種 Unix 環境 )
網址:http://www.cygwin.com/
點擊,如下方的圖示下載安裝檔
請選擇下一步
這邊我們使用從網路安裝 (預設)
若干的設定如下圖,大部份的人比較會動到安裝的位置
在這裡我安裝在 d:" cygwin下方:
接著給他一個,放置下載檔案的位置:
選擇連結到網路的方式
設定從那邊下載檔案,要選好自己國家或是速度較快的位置
不然你可能要等上老半天......
等待他下載安裝的資訊。
選擇要安裝的 packages
在這邊我把右上的 view 點至切換成 Full 來檢視 packages
這樣,我們可以依字母的排列來找到要安裝的 package 及說明
如下圖:
然後,我們安裝需要用到的四個 package 就好
分別是 gdb 、 gcc-core 、 gcc-c++ 、 make ,如下圖所示:
選好之後,按下一步並等待安裝結束。
要不要放 link 就因個人習慣囉.....
之後在環境變數中設置
CYGWIN_HOME 為安裝的目錄,在這邊是 D:"cygwin
PATH 加入,%CYGWIN_HOME%"bin,原本有的內容要以 ; 串接哦!
設好了之後到 NetBeans 中選 Tools ---> Plugin
讓我們在可安裝的 Plugins 中選擇 C/C++,並按 Install
按 Next
選 I accept ....... , 並按 Install
等待下載及安裝過程
顯示安裝 plugin 完成
如下圖,我們就可以在 new project 中看到 C/C++
相關的種類:
我們在建立的 Project 中的 Properties 中可以看到
GNU Complier Collection from Cygwin , 如下圖:
視需要 ( 如在用 JNI 時 ),記得要設定 Complier 中的 Command Line
-mno-cygwin -Wl,--add-stdcall-alias -shared -m32
如下圖
上方,參數的意義如下:
The -mno-cygwin option, enables building DLLs that have no dependencies on Cygwin own libraries and thus can be executed on machines which do not have Cygwin installed.
The -Wl,--add-stdcall-alias passes the --add-stdcall-alias option to the linker; without it, the resulting application would fail with the UnsatisfiedLinkError.
The -shared option tells the compiler to generate a DLL ( not an executable file).
-m32 tells the compiler to create a 32-bit binary. On 64-bit systems the compiled binaries are 64-bit by default , which causes a lot of problems with 32-bit JDKs.
參數的意義截自 http://www.netbeans.org/kb/55/beginning-jni-part1.html
----------------------------------------------------------------------------------
以上如有錯誤,歡迎告知改正
@font-face{ font-family:"Times New Roman"; } @font-face{ font-family:"宋体"; } @font-face{ font-family:"Symbol"; } @font-face{ font-family:"Arial"; } @font-face{ font-family:"黑体"; } @font-face{ font-family:"Courier New"; } @font-face{ font-family:"Wingdings"; } @font-face{ font-family:"Courier New CYR"; } p.0{ margin:0pt; margin-bottom:0.0001pt; layout-grid-mode:char; text-align:justify; font-size:10.5000pt; font-family:'Times New Roman'; } @page{}@page Section0{ margin-top:72.0000pt; margin-bottom:72.0000pt; margin-left:90.0000pt; margin-right:90.0000pt; size:595.3000pt 841.9000pt; layout-grid:15.6000pt; } div.Section0{page:Section0;}
原文地址:http://aa.pro.vexp.idv.tw/viewthread.php?tid=222&extra=page%3D1
- 17:44
- 浏览 (146)
- 评论 (0)
- 分类: NetBeans&&GlassFish
- 相关推荐
发表评论
我的相册
抓图1
共 10 张
共 10 张
最新评论
-
学习JavaFX 的好地方
Jekey 写道不错,就是javafx的开发工具太落后了,前途很是怀疑。等Jav ...
-- by gml520 -
学习JavaFX 的好地方
不错,就是javafx的开发工具太落后了,前途很是怀疑。
-- by Jekey -
一个易用不比Ubuntu差的Li ...
魔力猫咪 写道你Ubuntu里安装官方驱动不就可以了。ubuntu 里的驱动和官 ...
-- by gml520 -
一个易用不比Ubuntu差的Li ...
你Ubuntu里安装官方驱动不就可以了。
-- by 魔力猫咪 -
一个易用不比Ubuntu差的Li ...
的确不错..
-- by ufomail







评论排行榜