optics.csufresno.edu Class Files - ECE 71 HOWTOs
Department of Electrical and Computer Engineering
Dr. Gregory R. Kriehn, Professor

HOWTO Create Projects in NetBeans, and Compile & Execute Code

Setup Netbeans for Full Remote Development using the Tool Bar

In full remote mode, you can use the IDE running on your local host to work on projects that are located on a remote host by using the remote development tool bar.

Display the tool bar in the IDE by choosing View -> Toolbars -> Remote.

You can use the remote tool bar to select a remote host you have already configured and work on projects and files on the remote host the same as if they were local to your client computer.

Click the connection status icon (the computer icon) to connect to the server selected in the list next to the icon.  Be sure that ece71k[XX]@ezekiel.engr.csufresno.edu is selected. If you are already connected, clicking the icon again will disconnect you from the server.

The icon indicates connection status by turning green when connected and red when not connected.

Creating a New Project in NetBeans

To create a new project in NetBeans:

1.  Setup Netbeans for Full Remote Development using the Tool Bar.  Connect to the host account.
2.  Click the Folder icon with the + sign to create a new remote project.
3.  Make sure C/C++ is selected under Categories:, and click on C/C++ Application under Projects:. Click Next>.
4.  Choose an appropriate Project Name: (i.e., HW[X], where [X] is the current homework number you are working on).
3.  Under Project Location, verify the directory is /home/ece71k/ece71k[XX]/netbeans, where [XX] is your login number.  If this directory is not selected, type it in for your Project Location.
4.  Make sure the Create Main File box is selected. From the drop down menu, select C++14.
Verify the Build Host: is ece71k[XX]@ezekiel.engr.csufresno.edu, where [XX] is your login number.
6.  Verify the Tool Collection: is Default (GNU (GNU)),
and click Finish.

You may now begin coding your project.

Configuring Netbeans for Remote Debugging

To configure your project for remote debugging:

1.  Clean and Build the Project.
2.  Right Click on the Project in the Projects window on the left and select Properties.  Alternatively, select Run -> Set Project Configuration -> Customize... to bring up the Properties window.
3.  Under Categories, click on Run.
4.  Under Console Type, choose Standard Output.
5.  Click OK to exit the customization options.
6.  Set breakpoints, and click the Debug Project icon.

Including Additional Warnings from the GCC Compiler

To add more warnings from the g++ compiler:

1.  Click on Run -> Set Project Configuration -> Customize... .
2.  Under the Build category, click on C Compiler.
3.  Under Warning Level choose More Warnings from the drop down menu.

Choosing this option is the same as adding the -Wall flag to the linker under Additional Options. If you click on ... under Additional Options you will now see the -Wall flag added to the compiler. I highly recommend using the -Wall option when compiling your programs, as it provides additional feedback if there is problem when g++ tries to compile your code.

4.  Click OK to exit the customization options.

Compiling and Executing Code in NetBeans

After you have finished coding, you can compile your code by clicking on the Build Main Project button (the hammer icon). Alteratively, press F11. Notice that NetBeans automatically copies all of your source files over to a temporary directory on the server, logs into the server, and then tries to compile it. If you are prompted for a password when you click the Build Main Project button, type it in and press Enter.

If you want to delete all temporary files in your project, and build your program from scratch, click on the Clean and Build Main Project button (the broom and hammer icon). Alternatively, press Shift+F11.

If your project compiles successfully, click the Run Main Project button (the green arrow). Alternatively, press F6.

Since the Run Main Project button (the green arrow) also compiles your code, you can press this button the first time you compile your code if you are reasonably certain your program's syntax is correct. Most of the time, however, it is wise to first debug your program and ensure it compiles correctly before attempting to execute the code.