I have compiled slicer through the source code. Then i created a module (C++) and compiled it using cmake to generate module.sln. I want to debug this module using visual studio. What should I do?
Should I add this module project to slicer’s source project? I found some documentation on python debugging, but no tutorials on C++ modules I do?
Basically you need to start Visual Studio using the launcher: .\S4D\Slicer-build\Slicer.exe --VisualStudio
If you want to debug your own extension then you’ll need to add AdditionalLauncherSettings. The way I open VS for debugging SlicerRT: .\S4D\Slicer-build\Slicer.exe --VisualStudio --launcher-no-splash --launcher-additional-settings ./SlicerRT_D/inner-build/AdditionalLauncherSettings.ini c:\d\_Extensions\SlicerRT_D\inner-build\SlicerRT.sln
It also opens the solution.
Then you need to set basically any project as startup, then set the command to [superbuild_path]\Slicer-build\bin\Debug\SlicerApp-real.exe
then just start debugging.
This may be related to my visual studio version (I am using 2022), but when I follow these instructions, my module is not available in slicer.
To fix this, I needed to copy the --additional-module-paths from inner-build\SlicerWithMyExtensionLauncherSettings.ini and add them as command arguments to my startup project.