Data Structures
Setup dp4dsDistribution with NetBeans
Back to CoSc 320
The following steps will be demonstrated in class.
1. Almost all of the projects in the dp4dsDistribution software for this course use functions
in a Utilities library, which you must build first.
Start up NetBeans and select File -> New Project... -> C/C++ -> C/C++ Static Library
and click Next.
2. Click the Browse... button and navigate to the dp4dsDistribution folder that you have
installed on your computer.
Highlight the dp4dsDistribution folder in the Select Project Location window and click Open.
The Project Location field in the New C/C++ Static Library dialog box must end with dp4dsDistribution.
3. Change the Project Name to "Utilities" and click the Finish button.
The Projects Window on the left should show the Utilities project with a logical view of important
project contents such as source files, header files, and makefiles.
4. Right click the Header Files node under the Utilities project and select Add Existing Item...
5. In the Select Item dialog box, verify that you are in the Utilities folder within the
dp4dsDistribution folder, select the Utilities.hpp file and click the Select button.
Verify that Utilities.hpp has been added to the header files by expanding the Header Files node.
6. Right click the Source Files node under the Utilities project and select Add Existing Item...
5. In the Select Item dialog box, verify that you are in the Utilities folder within the
dp4dsDistribution folder, select the Utilities.cpp file and click the Select button.
Verify that Utilities.cpp has been added to the source files by expanding the Source Files node.
7. Build the Utilities library.
You can either click the Build hammer icon at the top, or you can right click on the Utilities
project node and select Build.
The Output window at the bottom should display "BUILD SUCCESSFUL".
8. The first project to use the Utilities library is the ArrayClassic project.
Select File -> New Project... -> C/C++ -> C/C++ Application and click Next.
9. Click the Browse... button and navigate to the dp4dsDistribution folder.
Highlight the dp4dsDistribution folder in the Select Project Location window and click Open.
The Project Location field in the New C/C++ Application dialog box must end with dp4dsDistribution.
10. Change the Project Name to "ArrayClassic".
11. IMPORTANT: Uncheck the Create Main File checkbox.
12. Click the Finish button.
The Projects Window on the left should show the ArrayClassic project with its logical view of important
project contents.
13. Right click the Header Files node under the ArrayClassic project and select Add Existing Item...
14. In the Select Item dialog box you will have to navigate to the ArrayClassic folder within the
dp4dsDistribution folder.
Select the ArrayClassicMain.hpp file and click the Select button.
Verify that ArrayClassicMain.hpp has been added to the header files by expanding the Header files node.
15. Right click the Source Files node under the ArrayClassic project and select Add Existing Item...
16. In the Select Item dialog box, verify that you are in the ArrayClassic folder within the
dp4dsDistribution folder, select the ArrayClassicMain.cpp file and click the Select button.
Verify that ArrayClassicMain.cpp has been added to the source files by expanding the Source Files node.
17. Before building any project, you must set three properties of the project -- the include files
for the compiler, the libutilities.a file for the linker, and the output window for execution.
To set the include files for the ArrayClassic project:
(a) Right click on the ArrayClassic node in the Project Window and select Properties.
(b) Select C++ Compiler in the left pane of the Project Properties dialog box.
(c) Click the button to the right of Include Directories in the General category.
(d) In the Include Directories dialog box, click the Add button.
(e) Navigate to the Utilities folder.
The File field must end with "dp4dsDistribution/Utilities".
Click the Select button of the Select Directories dialog box, then the OK button of the
Include Directories dialog box, then the Apply button of the Project Proporties dialog box.
18. To set the libutilities.a file for the linker:
(a) Select Linker in the left pane of the Project Properties dialog box.
(b) Click the button to the right of Libraries in the Libraries category.
(c) Click Add Library File... (NOT Add Library...) in the Libraries dialog box.
(d) In the Select Library File dialog box, navigate to the file libutilities.a.
It should be in dp4dsDistribution/Utilities/dist/Debug... .
Click the Select button of the Select Library File dialog box, then the OK button of the
Libraries dialog box (twice), then the Apply button of the Project Proporties dialog box.
19. To set the output window for execution:
(a) Select Run in the left pane of the Project Properties dialog box.
(b) Select Standard Output from the pull-down menu for Console Type.
(c) Click the Apply button of the Project Proporties dialog box.
20. Execute the main program.
You can either click the Run green triangle icon at the top, or you can right click on the ArrayClassic
project node and select Build.
To test the program, enter "10" for the array capacity and "numbers" for the file name.
The execution should terminate with "RUN SUCCESSFUL".
You can view and edit any text file by double clicking it in the Project Window.
To see a file that is neither a header nor a source file, click the Files tab, which is next
to the Projects tab.
For example, in the Files Window under the ArrayClassic folder, you can inspect the
content of the numbers file.
Most projects in the dp4ds distribution use Utilities, ASequence, AND ArrayT.
So, when you are setting up your projects always do steps 17(c-e) for each of these three projects.
Some projects use more than these three. If project X uses project Y, when you setup
project X you must do steps 17(c-e) for project Y.
Back to CoSc 320