5.1 Compiling Origin C FilesCompiling-Origin-C-Files
You can compile and link (build) your program automatically when you open an Origin project file, automatically when Origin starts, programmatically from LabTalk scripts or Origin C functions, and manually from within Code Builder. During the development of your program, you will most likely compile your functions manually from within Code Builder so that you can easily fix compile time errors and debug logic errors.
The following topics describe how to compile and link source files and how to build a workspace from within Code Builder. For information on automatically building source files when you open an Origin project file, on automatically building source files when Origin starts, and on programmatically building source files, see Automated Building page.
Note: Only source files that have been added to the Code Builder workspace can be compiled. To add an open source file to the Code Builder workspace, first make the source file is active in the MDI (for example, by pressing CTRL+TAB to activate the open files in sequence, by selecting the file from the Window menu, or by clicking on it in the Code Builder MDI). Once the source file is active in the MDI, select the File:Add to Workspace menu item or simultaneously press the CTRL+W keyboard keys.
|
Compiling Files
To compile a source file from within Code Builder, perform one of the following operations:
- Right-click on the file in the Workspace window and select Compile from the shortcut menu.
- Select the file in the Workspace window and then click the Compile button on the Standard toolbar.
To compile multiple files, select the desired files from the Workspace window and then perform one of the previous operations.
The compilation results are typed to the Output window. If an error message displays in the Output window, you can double-click on the message to go to the corresponding line of the source file in the Text Editor window.
Once you have compiled one or more source files, the source file's icon in the Workspace window displays a right directional triangle next to it. You can click on this triangle to open the source file tree. This tree can display the function definitions, function declarations, classes, structures, and type definitions for the source file. This display is controlled from the source file icon's Show shortcut menu. For more information, see Navigating in Files Using the Workspace Tree.
Stopping the Compiler
To stop the compiler, perform one of the following operations:
- Click the Stop Build button on the Standard toolbar.
- Select Build:Stop Compile.
- Press CTRL+Pause.
Building the Workspace
To compile all the source files that have been added to the workspace and to perform linking, do one of the following:
- Click the Build button on the Standard toolbar.
- Select Build:Build.
- Press SHIFT+F8.
If no files have changed since the last build, you will be notified of this in the Output window. In this case, you can force the compiler to rebuild by doing one of the following:
- Click the Rebuild All button .
- Select Build:Rebuild All.
- Press ALT+F8.
After building, the compiling and linking results are output to the Output window. If an error message displays in the Output window, you can double-click on the message to go to the corresponding line of the source file in the Text Editor window.
Once you've built the workspace, each source file's icon in the Workspace window displays a right directional triangle next to it. You can click on this triangle to open the source file tree. This tree can display the function definitions, function declarations, classes, structures, and type definitions for the source file. This display is controlled from the source file icon's Show shortcut menu. For more information, see Navigating in Files Using the Workspace Tree.
To exclude a source file from the build process:
- Right-click on the source file's icon in the Workspace window and select Set as Exclude from the shortcut menu. The icon updates to display a red X on it ( ).
Note: The workspace also has a Build on Startup option, available by right-clicking on the Workspace icon in the workspace window. This option controls whether or not the workspace will be rebuilt when you start an Origin session.
|
For more information on when and how files in the Code Builder workspace are built, see this page.
|