Using projects |
Top Previous Next |
Projects are the heart of multi module programming and combine all of the source files and resource information into a centralized project module. Using projects you can create very complex programs by separating your source code over multiple files and libraries. Subroutines and variables in source files can be either local or shared globally between files for ease of data reuse. Creating a new project
At this point you will see the File View pane in the Project Workspace window of the IDE with the project name. This is where source files contained in the project will be listed. The default location of the Project Workspace window is the lower right of the IDE. Opening an existing project Select the File menu and chose Open Project. Browse to the location of the project file and select Open from the file dialog. If the project directory was renamed, or copied from a different source, you will be prompted to update the project files. Selecting "Yes" to the prompt will adjust all of the internal paths in the project file to the new directory. The resource file will also be scanned for any needed path updates.
Closing a project Select the File menu and choose Close Project. You will be prompted to save any changes made to the project.
Adding source files Once a project has been created you can begin to add source files to the project.
It's common practice to keep all of the source files used in a project in the project directory. However, this is not necessary and your source files can be located anywhere on your drive. Adding other external library/object files A project may contain external object or library files. These can be specified in the source code with the $USE statement or added to the project by following these steps
For a static library project the external object files must be in the same directory as the project output. For other project types the external library/object can be located anywhere on the drive.
Adding resources
Once one or more resources have been added they can be modified by selecting the Resource View tab in the Project Workspace window of the IDE. The default location of the Project Workspace window is the lower right of the IDE. See Also: Using Resources
The $main directive When using projects it is necessary to tell the compiler where to start execution of your program. This is accomplished by using the preprocessor keyword $main. Only one source file can contain the $main keyword and it does not matter where the keyword appears. Execution will begin at the first statement or command that is not in a function. DLL's and Compile-Only projects do not require the $main directive See Also: Single file compiling
Modifying project options You can modify your projects options at any time by selecting the Project menu and choosing Options. A dialog similar to the New Project dialog will open allowing modification of the project name, type, debug build, and output name. It is not possible to change the location of the project directory once its been created. If you need to move the project directory create a new project and add the existing source files.
Compiling the project After adding source files and resources if any to the project you can build the executable or DLL by selecting the Build menu and selecting Rebuild All. You can also compile a single file for testing by selecting the Build menu and choosing Compile File. Any errors in the source files will appear in the Build pane of the Output Window. Double clicking on an error in a source file will display that file with the offending line highlighted. After a successful build of the project you can test the resulting executable by selecting the Build menu and choosing Execute ... . Alternately the program can be executed by clicking the green 'Go' button on the tool bar.
Removing source/library files If a source or library file is no longer needed by the project you can remove it by right-clicking on the file name in the File View of the Project Workspace window and choosing Remove from project. Removing a source file from a project does not delete the file, it just removes it from the list of source files in the project. You can safely re-add the file if necessary. |