SonarCloud and C++ code

It looks like SonarCloud must be able to build my C++ project to be able to scan it.
The project I try to scan uses an old framework (OwlNext). How can I pass the framework DLLs to sonarcloud so that it can build and link it ??

Also, my compiler is RAD Studio (not the CLang version of the compiler). I don’t think SonarCloud has this option.

Does it mean that I must use sonarQube installed localy and not SonarCloud ?

Hello @regis and welcome to our community.

When you create a C++ project on Sonarcloud, you should go through a tutorial that should explain you how to setup your C++ code analysis.

Generally speaking, it is a bit more tedious than for other languages.
SC does not need to build your project but only to know how your files are compiled. This is done with the so-called build-wrapper.
You can find the whole documentation about C++ analysis there:
https://sonarcloud.io/documentation/analysis/languages/cfamily/

On this page you will be able to see that your compiler is indeed not supported.
You can open a feature request in the community if you feel like it.

SonarCloud and SonarQube support the same compilers. So, SonarQube will not be able to help you there.

I hope it answers your questions.

Cheers

1 Like

Tks for your reply.

What still confuses me is that the documentation tells me in download in install things (the build wrapper for example). Since I’m using SonarCloud and BitbucketCloud, where do I download and install these ??

I have the same kind of issue for my C# (.net framework) projects I need to download MSBuild.exe but I don’t know how and where.

Hi @regis

In general your C++ code cannot be analyzed as long as you compile it with an unsupported compiler as your current compiler. If you manage to compile it with a supported compiler (as per the list in the documentation), analysis will be possible.

For all analysis, are you building your code with bitbucket pipelines? Do you have any other CI?
Do you want to analyze the code from there if any or from your own computer?

Source code is on BitBucket but I compile locally on my computer.

First, to be sure we understand each other. In the SonarCloud documentation, there is a distinction between Bitbucket Cloud (the overall platform including the part hosting your code) and Bitbucket Cloud Pipelines (the part that can host CIs and run analysis remotely).

You can download the required executables from the links that are provided in the helps for C++ and for C# / .NET.
Note that they are 2 different procedures. One for each language.
These executables are to be run from your machine.

If you are already compiling your C# project on your machine (with visual studio), you should have msbuild.exe installed already. And you should use the “Developer Command Prompt for VS 2019” that makes sure that all environments and paths are properly configured.

Hello @regis

Was that of any help?
Is there anything else we can do about your questions or shall I close the thread?

Cheers

I was able to scan my C# project using the Azure devOp pipeline (sources on bitbucket) but my C++ projects are build with a compiler that is not compatible. I ended up scanning these old project with CppCheck. That’s ok for now since I plan to port these old projects to C#.

You can close this thread.

Thanks.

Thank you Regis.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.