Creating a C/C++ Project: Updated for Lattix Architect 10

Creating a C/C++ Project Transcript

Back to the Video Gallery
Watch the video on YouTube


Today we’ll create a C++ project in Lattix Architect. You’re looking at the start screen when you open Lattix Architect. Let’s create a new project. Click Next to go to the Create dialog box. Choose the module type. We’ll choose C++ with Clang, which is the compiler built into Lattix Architect. Architect can also take data from Klocwork and from Understand.


There are three different ways in which you can enter the data. If you’re working on Linux, you will need to generate a Build Specification file using our utility called LXBuild.


Whenever we perform a C++ analysis, it’s important to know how you compile, what the macros are, where the include files are located, and what files are linked together. That’s the information contained in the Build Specification File. On Linux, the LXBuild utility allows you to create the Build Specification File.


You can read about it here. You will run the LXBuild command then you will run whatever command you use to build your application. For instance, if you use makefiles, then use the command make. If you use gradle of waf, specify the appropriate command. LXBuild will watch the compiles and the links as they take place. Once it has the list of compiles and links, it generates the Build Specification File. This file allows Lattix Architect to create a C++ project, which sets you up for architectural analysis.


The second option is to use Visual Studio, which we’ll look at shortly. The third option is to specify the source files and directories directly in the Project Configurer. You specify the macro options and which files go into which units.


Now let’s take a look at how you’re able to build a project using Visual Studio. Select Visual Studio and specify the Visual Studio solution file or the project file. Browse to the directory that contains the solution file or the directory that contains a single project file. When you load a solution file, it will load all the projects it contains. Then choose the build configuration. We’ll choose Release|Win 32 and click OK. Now we will create the project.


The benefit of using Visual Studio is that the project gives us the compile options, the include file locations, and so on. Here you can see that we built the project and now we can view the project. You can examine the project and look at the dependencies. Lattix Architect will allow you to look at the dependencies down to the line in code where the dependencies exist. You can look from the top down, starting at your project, then moving down to your directories, down to your files, and finally down to your methods and variables.


Now let’s look at the third method we mentioned. Let’s take a look at how you build a project using the Project Configurer. Those are the three options, all of which are documented here. You can turn this dialog box off if you don’t want to see it again. It is useful for first-time users to keep it displayed so you can review the options for building a project.


The third option is Project Configurer. Using Project Configurer, we directly identify the source files and the directories. Browse to the right high-level directory and select it. You can expand any directory and drill down eventually to the file level. You can add directories, remove directories, add files, and even remove files.


There are many options available to you. For example, through these options you can choose to compile just a single file. This is particularly useful if you’re using Project Configurer and run into compile errors. You may not want to re-build the entire project multiple times and, instead, just compile a few files, fix the error, and then re-build the project.


Once you have built the project, you can select different reports to run. A useful report is the Clang report. You can look at Diagnostics by File, as an example. This report is being run on the project we built with Visual Studio. In this case, we see that there are files with errors but no files with warnings. If we expand the files with errors, we can see that there was a header file that wasn’t found.


It’s a good idea to have Visual Studio installed on the machine where you are doing your analysis. There are ways to specify the include files on your own but the simplest way is to have Visual Studio installed.


These are the three different ways to build a C++ project. Once you’ve created a project, you have all kinds of analysis available to you. You can perform architectural analysis to find the dependencies that are problematic. You can find issues such as header files that are included but didn’t need to be included. You can find dependencies that exist that shouldn’t be there. Once you’ve created a project, you will have all sorts of architectural information available.


Thanks for watching. For more information, you can go to our website at You can even get a free evaluation. Thanks.