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 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.
  • Note Note  LabWindows/CVI will not report uninitialized local variable errors for uninitialized variable length arrays.
  • 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 Note  LabWindows/CVI disables this option in debug configurations or if you enable an external compiler.
    You can select whether the LabWindows/CVI compiler builds your code so that it uses the least amount of memory by selecting Optimize for space or whether the LabWindows/CVI compiler builds your code so that your code runs as quickly as possible at run time by selecting one of the Optimize for speed options. Higher optimization levels result in more aggressive optimization and require longer compilation times. You can select from the following options:
    Note 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 Note  You must have the LabWindows/CVI Execution Profiler Toolkit installed to take advantage of this option. Users with the LabWindows/CVI Full Development System can install the Execution Profiler Toolkit and activate it using the LabWindows/CVI Full Development System activation code. Visit ni.com to purchase the Execution Profiler Toolkit for use with the LabWindows/CVI Base Package.
    • 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.
  • Require function prototypes—Requires you to precede all function references with a full prototype declaration. A full prototype includes the function return type and the types of each parameter. If a function has no parameters, a full prototype must have the void keyword to indicate this case. A new style function definition (one in which you declare parameters directly in the parameter list) can serve as a prototype.

    Missing prototype errors can occur at the following places:

    • Typedefs such as typedef void FUNTYPE()
    • Function pointer declarations such as void (*fp)() whether used as a global, local, parameter, array element, or structure member
    • Old style function definitions, in which you declare parameters outside of the parameter list, that you do not precede with a full prototype
    • Function call expressions such as (*fp)(), where fp does not have a full prototype
    Caution  It is best to enable the Require function prototypes option. If disabled, some of the run-time error checking also is disabled.
  • 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 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 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.

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 filePrecompiles 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.

WAS THIS ARTICLE HELPFUL?

Not Helpful