CLION: how to generate class diagrams from C++ source code - c++

I have used Visual Studio successfully to generate class diagrams from C++ source code.
But I'm finding it hard to do the same in CLION. I used Settings / Preferences | Tools | Diagrams as per the JetBrains documentation, but it throws this error CLION diagrams error. "The current file or folder does not have any dependencies. Please try with another file or folder". But my source code is indeed having many dependencies.
How to generate class diagrams (UML or non UML) from C++ source in CLION?

I'm not familiar with CLion, but from what I've googled, it seems that CLion does not support C++ class diagrams: see this support question about UML Diagrams in CLion and the corresponding feature request OC-1038 filed ten years ago, still not implemented.
However, CLion seems to have a basic UI allowing you to browse class hierarchy by pressing Ctrl+H, as shown in this CLion: A Modern C++ IDE video by Dmitri Nesteruk from JetBrains at 41:43.

Related

I'm trying to use native C++ libraries in a MAUI app and cannot get it working for MacOS/iOS

There's a great article here that describes how to use native C++ libraries in Xamarin/C#, and I would assume that this would extend to MAUI: https://learn.microsoft.com/en-us/xamarin/cross-platform/cpp/
I followed these instructions, and put together an end-to-end demo solution of it here: https://github.com/whodges/bindingsample. This does require that you link Visual Studio to a MacBook to build the full solution.
That example essentially uses the default MAUI template, and modifies it slightly so that the actual 'click counter' value is set and retrieved from a native library on a per-platform basis. For Windows, that's a C++ DLL (works great). For Android, that's a .so library (works great). And for iOS, that's a static .a library, and here's where I'm running into trouble: when I try to launch this app using the iOS Simulator, it fails with a clang++ error, and something along the lines of "Could not extract the native library 'libCounteriOS.a' from .../obj/Debug/net6.0-ios/iossimulator-x64/linker-cache/libCounteriOS.a'. Please ensure the native library was properly embedded in the managed assembly (if the assembly was built using a binding project, the native library must be included in the project, and its Build Action must be 'ObjcBindingNativeLibrary')".
I created a C# .NET iOS Binding Library project (Counter.iOS in my example), and this is supposed to bundle libCounteriOS.a, which is generated when CounteriOS (a C++ project) is compiled. First, when Counter.iOS is built using Visual Studio on Windows, it fails to generate the Counter.resources folder in its 'bin' folder, along with the subsequent 'manifest' file. When I use Visual Studio for Mac, these files do get generated. So, I stuck with Visual Studio for Mac to build the iOS.Counter project (everything else is built with Visual Studio on Windows).
Regardless, I still get the "could not extract the native library" error I described. I've tried setting the library file's Build Action in Counter.iOS to ObjcBindingNativeLibrary, but that just results in an unhelpful "Build failed - see build log for details" error in Visual Studio for Mac, and I cannot find said log file for the life of me. On top of that, it's not an Objective C library anyway - it's a C++ one - so I'm not sure if this step is actually appropriate. Does it have to be Objective C? The Xamarin article suggests otherwise, and the native reference option 'Is C++' is there as well. I've also tried setting libCounteriOS.a's Build Action to 'BundleResource' - no luck with that either. I've tried it with .NET 7.0 as well - also no luck there.
I'm really at a loss. Is this even possible? It doesn't seem to work and I've been poking at it for weeks on it. That Xamarin article seems to suggest it should be possible. Any help would be greatly appreciated.

C++ VSCode Intellisense Popup is Lacking Proper Description/Linting

I installed Microsoft's C++ extension on VSCode, but when I'm writing C++ code,
my screen looks like this.
The autocompletion feature works, but there is no documentation/proper description given to me for any of the built-in C++ functions/classes. Compare the above to what it looks like on an official screenshot of the C++ VSCode extension.
I have my \msys64\mingw64\bin folder added to path too, so there shouldn't be a problem there. Any suggestions on how I can fix the tooltips my IDE gives me for C++?

How can I change build tools for projects in VS Code?

I want to build a C++ code but it errors. When I check the error message it's related with .NET. I have C# extensions but this isn't C# and I want to change this to g++ for C++ projects. I have g++ installed and added to path however I don't know how can I configure it to build with that for C++ codes.
Edit: I marked the answer as a solution but I also found an easier way for me:
https://code.visualstudio.com/docs/cpp/config-msvc
cl.exe basically.
One option (probably not the one you want to) is to build it from integrated terminal.
You can download c/c++ extension along with the cmake tools extension to have buttons for build/run configuration.

How to view build issues in Clion more readable?

In QT Creator build issues are showed in window as readable, filterable, customizable list.
Example of build issues in Qt Creator:
But in CLion it just a text list with links to build issues.
Example of build issues in CLion:
How to view build issues in CLion more readable?
I think that the main reason is that Qt Creator uses the clang toolkit to gather semantic information about the code, while CLion has its own C++ parser. As such, CLion has a direct representation of the compiler errors and warnings, as you mention.
On the other hand, CLion is able to notify you of errors and warnings without compiling the code, immediately :-) This feature is called "Code inspection", is customizable and filterable, and will give you even more information than the compiler.
You can find it under Code | Inspect code....
Example output:
See also my other answer to a similar question.

LLVM 3.8: implementing a pass with ad IDE (Xcode)

I'm a newbie in both LLVM developing and cpp.
I wanted to ask if there was a way to develop a pass for LLVM in Xcode having all the typical features available in an IDE like autocomplete and syntax code highlighting.
Right now I am just writing c++ code, checking everything I need on the documentation, but, as you can imagine, this is really slowing me down and it's really error prone...
Don't know if this can help, but my LLVM folder is structured this way:
"llvm_3.8_source/" root folder of llvm3.8 source files
"llvm_3.8_source/build" root folder of my llvm3.8 build
Thanks
Yes, it is possible.
LLVM uses CMake as a build-system generator. CMake supports such things as old good makefiles, ninja, xcode, and visual studio.
You can simply create Xcode-project using the following commands from terminal:
cd llvm_build
cmake -G Xcode path/to/llvm/sources
open LLVM.xcodeproj
First you will see lots of errors and 'red' marks. It's because some parts of LLVM sources are generated during compilation.
All files will be generated as soon as you attempt to build project first time and all the 'red' marks will gone.
You can read this article to get a bit more info on the topic:
Getting started with LLVM/Clang on OS X