Options»Build Options
You can set the LabWindows/CVI compiler options by selecting Options»Build Options in the Workspace window. This command opens a dialog box that displays Configuration Options and Build Process Options tabs.
Refer to the Persistence of LabWindows/CVI Dialog Box Options topic for more information about where dialog box options are saved and what they affect.
Configuration Options Tab
The following options are available on the Configuration Options tab:
- Configuration—Applies the settings on the Configuration Options tab to the selected configuration. The following configurations are listed by default:
- Debug—Settings apply to the default 32-bit debug configuration.
- Release—Settings apply to the default 32-bit release configuration.
- Debug64—Settings apply to the default 64-bit debug configuration.
- Release64—Settings apply to the default 64-bit release configuration.
- All Configurations—Changed settings apply to all configurations.
Note - Any custom configurations you create are also listed.
- If you access this dialog box from the Add Configuration or Edit Configuration dialog boxes, the Build Process Options tab is hidden and LabWindows/CVI dims the Configuration option. LabWindows/CVI applies the changes you make in this dialog box to the configuration specified in the Add Configuration or Edit Configuration dialog box.
- Default calling convention (32-bit)—Sets the compiler's default calling convention for 32-bit projects. The default calling convention is normally __cdecl but can be changed to __stdcall. Do not change the default calling convention to __stdcall if you plan to generate static library or object files.
The calling convention for 64-bit projects is __fastcall. You cannot use __fastcall as the calling convention for 32-bit projects.
Note If you want to create an object file, static library file, or DLL that exports functions with the __stdcall calling convention, it is a good idea to explicitly declare the functions as __stdcall in the include (.h) file and the source (.c) file rather than relying on the Default calling convention option. If you do not explicitly declare the functions as __stdcall in the include file and if another developer uses the object file, library file, or DLL in LabWindows/CVI or an external compiler without setting the default calling convention to __stdcall, the functions do not work correctly. - Maximum stack size (bytes)—Adjusts the maximum stack size in the program.
Your program uses the stack for passing function parameters and storing automatic local variables. By setting a stack limit, LabWindows/CVI can catch infinitely recursive functions and report a stack overflow. If you enable the Detect uninitialized local variables at run time option in this dialog box, LabWindows/CVI uses extra stack space. You can adjust your maximum stack size to avoid a stack overflow. - Stack allocation size (bytes)—Specifies the amount of stack space to commit to the stack as it is needed.
- Image base address—Specifies the address where LabWindows/CVI loads a DLL or executable into memory. By specifying the image base address, you can avoid relocating DLLs, which can slow down the load time of DLLs. You also can avoid collisions, which occur when LabWindows/CVI attempts to load more than one DLL with the same address.
You can specify any value, or you can select the following default values:
- x00400000 for 32-bit executables
- x10000000 for 32-bit DLLs
- x0000000000400000 for 64-bit executables
- x0000000010000000 for 64-bit DLLs
- Optimization level—Specifies the optimization level with which to compile the project.
Note LabWindows/CVI disables this option in debug configurations or if you enable an external compiler. - No optimizations
- Optimize for space
- Optimize for speed (level 1)
- Optimize for speed (level 2)
- Optimize for speed (level 3)
Caution Selecting a higher optimization level can cause undefined behavior in your programs at run time if your code does not strictly conform to the C specifications. - Profiling—Sets the profiling level in your application.
Note You must have the LabWindows/CVI Execution Profiler Toolkit installed to take advantage of this option. The LabWindows/CVI Execution Profiler Toolkit can only profile source code compiled with the LabWindows/CVI compiler. Profiling source code compiled with third-party compilers is not supported. - Disabled—Disables profiling.
- User functions—Profiles only the user-defined functions in the application.
- User functions and other calls—Profiles the user-defined functions and calls to other library objects that have source in a project that is not built with profiling enabled. For example, other calls might include calls to LabWindows/CVI functions, Windows SDK functions, and so on.
- Debugging level—Sets the debugging level in your application. LabWindows/CVI uses this setting only if you enable a debug configuration, for the project. If you enable a release configuration, LabWindows/CVI compiles all source files (*.c) without debugging information.
Select one of the three debugging levels for the source modules in your application.
- No run-time checking—In this level, you can set breakpoints and use the Variables and Call Stack window. You have no protection from run-time memory errors, and you cannot use the Run»Break on»Library Errors option.
- Standard—In this level, you can set breakpoints, use the Variables and Call Stack window, and use the Run»Break on»Library Errors option. You also have protection from run-time memory errors.
- Extended—This level has the same benefits as Standard mode, with added user protection that validates every attempt to free dynamically allocated memory by verifying that the address you pass is actually the beginning of an allocated block.
Select this level to enable resource tracking by default. Resource tracking is available only in the LabWindows/CVI Full Development System.
- Detect uninitialized local variables at run time—Checks for the run-time use of variables that do not have values assigned to them. Enabling this option causes LabWindows/CVI to use extra stack space. To avoid a stack overflow, adjust the maximum stack size. LabWindows/CVI uses this setting only if you enable a debug configuration for the project.
- Compiler Defines—Accepts user-defined macros.
- Predefined Macros—Lists the predefined macros.
- Warning level—Sets the warning level for the compiler warnings that appear in the Build Output window. Select from four predefined warning levels in the Build Options dialog box or click the ... button to open the Compiler Warnings dialog box to customize the warning levels.
- None—Displays no warnings.
- Common—Displays the warnings labeled as Common.
- Extended—Displays the warnings labeled as Common and Extended.
- All—Displays the warnings labeled as Common, Extended, and All.
When you add or remove warnings from a warning level, LabWindows/CVI places an asterisk (*) next to the warning level label to indicate this modification.
If you open a project saved in LabWindows/CVI 2012 or earlier, LabWindows/CVI automatically selects the warnings for the project that correspond to the LabWindows/CVI 2012 and earlier settings. - Show warning flags in Build Output window—Displays the warning flags, in the Build Output window, that the compiler uses.
- Build with C99 extensions—Specifies whether LabWindows/CVI compiles the project with C99 extensions enabled.
In specific sections of your code, you can override this project-wide setting by using the associated pragmas in the source code.
Note - For more information about the C99 language extensions supported in LabWindows/CVI, visit ni.com/info and enter the following Info Code: CLangExt.
- C99 extensions might not be supported in external compilers.
- Enable OpenMP support—Specifies whether LabWindows/CVI compiles the project with OpenMP support enabled.
Note - You must enable the Build with C99 extensions option before you can enable the OpenMP support option.
- The OpenMP Run-Time Library is available only in the LabWindows/CVI Full Development System.
![]() |
Note LabWindows/CVI will not report uninitialized local variable errors for uninitialized variable length arrays. |
Build Process Options Tab
The following options are available on the Build Process Options tab:
- Track include file dependencies—Keeps the project up-to-date by tracking the dependencies between source files and include files. Whenever you modify a file and then build, LabWindows/CVI compiles all source files that include the modified .h file.
- Prompt for include file paths—Prompts you to make a manual search for any header files listed in the #include lines that the compiler cannot find. When you find them, you can automatically insert the appropriate path into the Include Paths list for the project.
- Compile with precompiled include file—Precompiles frequently used header files to decrease compile time.
- Active 32-bit compiler—Specifies which 32-bit compiler configuration to use for release configuration compiles. Click the … button to the right of this option to open the Compiler for 32-bit Release Configuration dialog box, which you can use to modify the list of all available configurations.
- Active 64-bit compiler—Specifies which 64-bit compiler configuration to use for release configuration compiles. Use the … button to the right of this option to open the Compiler for 64-bit Release Configuration dialog box, which you can use to modify the list of all available configurations.
- Number of concurrent compiles—Specifies the number of CPUs to use to compile source files at one time.
- Warn when saving files during build—Warns when LabWindows/CVI saves a file you have modified while your project is building.
- Maximum number of compile errors—Sets an upper limit on the number of compile errors that LabWindows/CVI allows for each source file before terminating compilation for the file.
- Stop on first file with errors—Sets the LabWindows/CVI compiler to terminate compilation after it finds a file with errors. If other files are compiling concurrently when LabWindows/CVI detects an error in a file, those files complete compilation. LabWindows/CVI terminates compilation for any other files in the current build. Using this option, you can correct build errors in your project one file at a time.
- Show Build Output window when build starts—Displays the Build Output window when you begin building a project, which shows the name of the file being compiled, errors and warnings encountered, and the result of the build.
- Show Build Output window for errors—Sets the LabWindows/CVI compiler to open the Build Output window when errors are encountered during the build
- Encoding—Specifies the character encoding for the project. The compiler uses this encoding to interpret the contents of all project source files. If you select UTF-8, the CVI_UTF8 compiler define is added to the Predefined Macros. The CVI_UTF8 macro automatically resolves functions that take string parameters to the UTF-8 version of the function if the function has UTF-8 support. The UTF-8 version of the function is suffixed with Utf8 while the ANSI version is suffixed with Ansi.
Note When you specify the encoding of your project, LabWindows/CVI converts your project configuration and the associated source code (*.c, *.h) and user interface (*.uir) files to the encoding you specify. For the source code files, LabWindows/CVI converts the file encoding. For the user interface files, LabWindows/CVI converts the encoding of the panels and menus.