Generate a JSON Compilation Database inside Visual Studio

Ionut Enache Ionut January 12, 2021

When LLVM started to take over most of the C++ industry, many developers wanted to compile their existing Visual Studio C++ projects using the Clang compiler.

In order to do that, you need to create a JSON Compilation Database, and here Clang Power Tools comes into play.

Generate a JSON Compilation Database

Using the Context Menu from the Solution Explorer is the traditional way to access the main actions for a Visual Studio project, so this is exactly what you are going to do next.

  1. Right-click on the Visual Studio project to open the Context Menu.
  2. Select the Clang Power Tools option.
  3. In the opened submenu, choose Export Compilation Database.Generate JSON Compilation Database Option
  4. File Explorer is automatically opened with the JSON Compilation Database selected.Generated JSON Compilation Database File

Watch our video tutorial to see the JSON Compilation Database in action.

Conclusion

At this point, you have everything you need to generate your own JSON Compilation Database files and start using the Clang compiler on your C++ Visual Studio projects.