C++ Object File (*.obj, *.o)

From RAD Studio
Jump to: navigation, search

Go Up to File Types Index


A C++ object file is an intermediate file produced by a C++ compiler from a C++ implementation file and the C++ header files that the implementation file includes. The C++ linker produces the output executable or library of your project from your C++ object files.

RAD Studio can generate C++ object files from both Delphi and C++ projects.

The file extension of C++ object files is:

  • obj when you build your project for 32-bit Windows.
  • o when you build your project for any other supported platform.

C++Builder Object Files

When you build a C++ project, RAD Studio generates a C++ object file for each unit in your project and a C++ object file for your project.

When you build your C++ project, RAD Studio generates your C++ object files by default into C:\Users\<user>\Documents\Embarcadero\Studio\Projects\<project>\<platform>\<build configuration>.
For packages, RAD Studio also creates a static version of your C++ object files, generated by default into C:\Users\<user>\Documents\Embarcadero\Studio\Projects\<project>\<platform>\<build configuration>\staticobjs. See Building Static Packages for more information.

To change the output directory, use the Object file output directory option in Project > Options > C++ Compiler > Directories and Conditionals.

C++ Object Files in Delphi Projects

When you build Delphi projects, RAD Studio generates a C++ object file for each unit in your project and a C++ object file for your project if you select any of the following values for the C/C++ Output file generation option in Project > Options > Delphi Compiler > Output - C/C++:

  • "Generate C .objs"
  • "Generate C++ .objs"
  • "Generate C++ .objs, headers"
  • "Generate C++ .objs, headers, namespaces"
  • "Generate C++ .objs, headers, namespaces, export"
  • "Generate C++ .objs, namespaces"
  • "Generate C++ .objs, namespaces, export"
  • "Generate C++ .objs, headers, exports"
  • "Generate C++ .objs, exports"
  • "Generate all C++Builder files (including package libs)"
Note: For Delphi packages, only the last choice is offered.

When you build your Delphi project, RAD Studio generates your C++ object files by default into C:\Users\<user>\Documents\Embarcadero\Studio\Projects\<project>\<platform>\<build configuration>.
To change the output directory, use the C/C++ .obj/.lib output directory option in Project > Options > Delphi Compiler > Output - C/C++.

See Also