You can get started using Distributed NetBeans right away after installing the Distributed NetBeans Module (and restarting the IDE if prompted to do so). In this topic, a simple example and instructions will illustrate key steps in using DistributedNetBeans.
Step 1: Create and mount a directory
The mounted directory appears in the Explorer with its directory specification (in Unix syntax).
A newly mounted directory (EFS$:[user.projects.Example]) in the Explorer
Step 2: Create a new Fortran source file
Selecting the simple C++ main program on the Choose Template page
Step 3: Edit the source file
The Source Editor window should with the HelloWorld.cpp file open to edit. If the Source Editor Welcome screen or another source file is visible, click the HellowWorld tab (at the bottom).
The complete code of HelloWorld.cpp
Step 4: Compile HelloWorld.cpp
In this step, you will use properties called compiler settings to compile your sources. This method does not require a command file. Instead, the Fortran module constructs a DCL command line that invokes your chosen compiler with the various arguments you require. Each argument is represented by a macro, the properties of which you can set individually.
- Right-click on the HelloWorld file in Explorer and select Properties from the context menu.
- Click the Compiler Settings tab and examine the default values of the properties.
The C++ Compiler Command executes the cxx command using the /optimize and /warnings compilation options. You can try specifying another property, such as /debug.
- Right-click on the HelloWorld file in Explorer and select Compile from the context menu.
- View the result of the compilation in the Output Window.
Compiling also saves the source file.- Choose the Compile command again.
The Output Window should show: Command completed. No files needed to be created, changed, or deleted.Finished HelloWorld.
- From the right-click menu for the HelloWorld file, select the Build command.
The Output Window shows the successful compilation output again.
This illustrates the difference between compiling and building. Building always compiles the sources even when they are unchanged from the last compilation.
Selecting the Compile command
Successful compilation output
Step 5: Navigating a compilation error
- Introduce a fault into the code by deleting the semicolon on the printf line.
- Choose the Compile command again and view the compilation error in the Output Window.
- Click on the underlined part of the error: HelloWorld.cpp [14:1], and the Source Editor selects the line as illustrated (the error occurs in the line following the omitted line delimiter).
The compiler error, CXX-E-EXPSEMICOLON, is reported along with its line number and character position [14:1]
Source Editor line is highlighted
Step 6: Compiling with a DCL command file
So far, the compilation method has been to use the compilation properties that are associated (or you associate) with a source file. These properties are passed to the compiler (the CXX compiler in this case) using the DCL command line. With the Fortran module, you can also use an existing or a new command file to compile or build your source code.
Part 1: Create a command file
$ cxx /optimize /debug /warnings
/object= [<YOUR DIRECTORY SPECIFICATION>] 'P1'
The complete command file in the Source Editor
Note that the compiler command does not specify the source file, but uses the P1 parameter. If there are multiple source files, each one will be built with this command file.
Part 2: Execute the command file
Selecting the Use Command File option
Part 3: Use a DECterm window
If your command file requires any kind of input, you will need to execute it in an interactive window. You can do this by directing the output to a DECterm windows instead of the NetBeans Output Window.
- Right-click the HelloWorld file and select the Command File Settings tab.
- In the Use DECterm field, select True.
- Now click Build.
Selecting the DECterm option
A DECterm window opens. If the only text in the window is Press enter to exit, the compilation is complete and there are no errors. You can dismiss the window by pressing Enter when you're ready.
You can also set the Use DECterm property to True for an individual command file (on its property sheet's Execution Settings tab). In this case it will apply to all source files for which you use that command file. For example, applying this property to a command file could be useful if you know that its use always requires your interaction to specify various special parameters.