I built Slicer from source in debug mode. Now I’m trying to work with Slicer as with usual project but Qt creator can’t see any execution file and moreover header files are inactive like in the picture below:
I suspect that because those execution files are not added in CMakLists.txt
How usually people debug SLicer?
Windows 10, MSVC 2017, Qt 5.14.2, ninja, Master Slicer branch
Slicer source dir: C:\S\Slicer
Build dir: C:\S\d
I built SLicer using .bat:
cd /d %SLICER_BIN_DIR%
%CMAKE_EXE% %SLICER_SOURCE_DIR% -G Ninja -DQT_QMAKE_EXECUTABLE:PATH=%SLICER_QMAKE_EXE% -DSlicer_USE_PYTHONQT_WITH_OPENSSL:BOOL=ON ^
Next, according to the documentation I should be able to launch QtCreator with:
.\Slicer.exe --launch C:\Qt\Tools\qtcreator-4.11.0\bin\qtcreator.exe
But I get error:
Have you tried building using my configuration as described in https://github.com/Slicer/Slicer/issues/5300#issuecomment-728351584?
Slicer 4.11.20200930 git tag, VS 2019, Qt 5.15.1 (MSVC 2019, 64-bit) and a recent CMake version (I use CMake 3.18.4 successfully).
I tried to use stable release with
git checkout v4.11.20200930 but the problem occurs when building
LibArchive. It is discussed here LibArchive build errors
Thus I’m working with master branch.
I have not tried VS 2019 and Qt 5.15.1 as my other project uses VS2017 and Qt 5.14.2
I can try to rebuild Slicer with VS 2019, Qt 5.15.1 (or even Qt 5.15.2) but what to do with
LibArchive? Should I still use master branch or 4.11.20200930 git tag? Or maybe I will not encounter such problem with VS 2019
I will rebuilt it and report the result
I just compiled SLicer 4.11.20200930 git tag with MSVC 2019 and Qt 5.14.2
I still got the error:
But I can skip it and continue to normally launch Slicer.
The main question is still undclear, how to open Slicer project and debug Slicer in Qt?
I follow this documentation https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/QtCreator
and with MSVC 2019 Qt 5.15.2 it doesn’t give platform plugin error anymore. That is good. After I press
ENTER nothing happens. THose two lines in CMD are shown.
and this is how my project is look like:
I’ve never used the Qt Creator IDE so I can’t provide much help on how to proceed there.
You can also view info at https://slicer.readthedocs.io/en/latest/developer_guide/build_instructions/windows.html?highlight=Debugging#debug-slicer which has some information about various Slicer debugging using Visual Studio whether C++ or Python based debugging.
Thank you a lot! Finally when I 99 % followed the instructions from here (previously I used to build it with Ninja and now I’ve built it with VS 2019 x64 build system) I could launch Slicer from VS 2019 and stop it at a break point in debug mode.
As I don’t really like writing code in VS I’m going to download and try to use VS code. If there is something that I should know about this idea, please notify me
By the way now there is no any errors when I launch Slicer as it used to be earlier.
3 posts were split to a new topic: Use HDF5 library in a Slicer module
Hello I am stuck by the same step in qtcreator Ubuntu OS
Would you like to share some detailed steps to configure the project
@SteveLiu QtCreator doesn’t support intellisense and other staff for cmake superbuild projects (I as I know).
How I use QtCreator with Slicer:
Slicer may build extensions along. (or you can find any and build it externally by yourself).
Extension is a complete cmake project that you can open with QtCreator.
Extension needs to
find_package(Slicer) and usually it uses some headers from Slicer
If you open an extension in QtCreator then you will see that intellisense work fine there (probably if the extension doesn’t use Superbuild).
Also if you then open Slicer source files while the extension is an active project in QtCreator than you will find that intellisense also work for Slicer (probably not as good as for regular project but it is pretty enough).
To make a little easier I prefer switching the mode of a tree view in left upper corner: from
Files system so that there is no greyer-out header and source files