NetBeansInstallGuide.pdf

(374 KB) Pobierz
NetBeans & MinGW Install Guide for C CMPT 130
NetBeans & MinGW Install Guide for C
NetBeans is an IDE for programming. We'll use it for writing C code, but we'll also need a
compiler. This guide walks you through the basics of setting both up.
1. Tools
You may need the following tools/programs in order to install NetBeans:
1. Java Run-time Environment (JRE): http://java.com/en/download/index.jsp
2. Java Development Kit (JDK):
2. Install a Compiler
Windows: MinGW
1. Download the installation package for MinGW:
http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-
20120426/mingw-get-inst-20120426.exe/download
2. Run the executable.
◦ Select either “Use pre-packaged repository catalogues” or update from online.
◦ Select to install both of:
1. C Compiler
2. MSYS Basic System (near bottom of list)
2.1
3. It will download content from the Internet while installing so it may take a while.
Generated Aug 29, 2013, 11:57 PM
Page 1/6
© Dr. B. Fraser
1158642202.017.png 1158642202.018.png 1158642202.019.png 1158642202.020.png 1158642202.001.png 1158642202.002.png 1158642202.003.png
 
NetBeans & MinGW Install Guide for C CMPT 130
4. Add the MinGW and MSYS directories to your path as follows:
◦ On the keyboard, press the Windows key and the R key to show the run dialog.
◦ Enter the following and press enter to launch the System Properties dialog:
control sysdm.cpl
◦ Select the Advanced tab, and click the Environment Variables button:
◦ If there is a “PATH” variable in the top section, Edit it; Otherwise, select New.
◦ Set the Variable name to: PATH
Add/set the Variable value to: C:\MinGW\bin\;C:\MinGW\msys\1.0\bin
(Assuming default install location. Copy and paste this to get punctuation right.)
DO NOT ADD EXTRA SPACES TO THE TEXT . There is no space before the
“C:\..” If the path variable already exists, add a semicolon to before your added text.
◦ Click OK to close each dialog box.
Generated Aug 29, 2013, 11:57 PM
Page 2/6
© Dr. B. Fraser
1158642202.004.png 1158642202.005.png 1158642202.006.png
NetBeans & MinGW Install Guide for C CMPT 130
5. Test your installation with the following:
◦ Launch a command line (terminal):
- From the start menu, select Run .
- Enter: cmd
◦ Type the command: gcc --version
(That has two dashes)
◦ Type the command: make –version
(Also with two dashes)
◦ You should see:
◦ If you do not see the above output, it likely means that there is a problem with your
installation or path, as described below:
Generated Aug 29, 2013, 11:57 PM
Page 3/6
© Dr. B. Fraser
1158642202.007.png 1158642202.008.png
NetBeans & MinGW Install Guide for C CMPT 130
6. Troubleshooting:
◦ Check your installation with the command: dir C:\MinGW\bin\gcc.exe
◦ Check your path with the command: PATH
Make sure there are no extra spaces, and that you have the correct ; and : symbols.
Somewhere in the path (on screen) you should see:
Mac: XCode
I believe the XCode package includes a C compiler that works with Eclipse. I cannot provide
direct support for getting this working, but I have read it should work.
2.2
Linux:
GCC in installed on most Linux distributions. If not, use the package manager to install it.
2.3
3. Install NetBeans IDE
1. Download the latest version of NetBeans IDE for C/C++ from
◦ Select the operating system you run in the upper right.
2. Once downloaded, run the installer.
◦ If under Linux, you may need to change the permissions to be executable. Use the
following command (from the directory containing the installer):
chmod a+x netbeans*.sh
3. See the “Configuring NetBeans” guide for how to setup NetBeans.
4. See Lab 1 for a walk-through on how to begin using NetBeans.
Generated Aug 29, 2013, 11:57 PM
Page 4/6
© Dr. B. Fraser
1158642202.009.png 1158642202.010.png 1158642202.011.png 1158642202.012.png
 
NetBeans & MinGW Install Guide for C CMPT 130
4. NetBeans Setup and Trouble Shooting
If you cannot create a NetBeans C/C++ project (option is not listed when creating a new project),
then:
1. From within NetBeans, select the following from the menu: Tools → Plugins
2. On the Available Plugins tab, select the C/C++ option and click Install.
3. Note: You may have to do this on the lab machines if the C/C++ project type does not
show up.
If you cannot compile (toolchain not found) then:
1. When you create a new C/C++ project in NetBeans, it should automatically detect the
installed compiler and make tools, such as the following screen shows:
2. If there is a problem (such as tools not found), please double check:
◦ you installed both the C Compiler, and MSYS (under Windows); or on Mac OS that
you have installed a compiler.
◦ you have configured the PATH correctly (Windows), as described earlier.
3. You can have NetBeans try to
re-detect the MinGW tools by
going to Tools → Options, and
on the C/C++ tab click
Restore Defaults.
4. You can manually change the compiler settings inside NetBeans by:
◦ On the menu, select Tools → Options
◦ Select the C/C++ tab.
◦ Either manually change the settings, or try “Restore Defaults” and it may re-scan for
tools. Note that if you just changed your PATH variable, you may need to restart
NetBeans.
Generated Aug 29, 2013, 11:57 PM
Page 5/6
© Dr. B. Fraser
1158642202.013.png 1158642202.014.png 1158642202.015.png 1158642202.016.png
 
Zgłoś jeśli naruszono regulamin