Custom app compile error (Slicer_MAIN_PROJECT_VERSION_FULL undefined)

I created a custom Slicer application using

cookiecutter gh:KitwareMedical/SlicerCustomAppTemplate

two days ago (main branch is at commit daaa550).

Compilation of all dependencies seems to work, but the compilation of Main.cxx of the custom app fails with

/opt/MyApp/Applications/MyAppApp/Main.cxx: In function ‘int {anonymous}::SlicerAppMain(int, char**)’:
/opt/MyApp/Applications/MyAppApp/Main.cxx:50:90: error: ‘Slicer_MAIN_PROJECT_VERSION_FULL’ was not declared in this scope; did you mean ‘Slicer_MAIN_PROJECT_APPLICATION_NAME’?
   50 |     QString windowTitle = QString("%1 %2").arg(Slicer_MAIN_PROJECT_APPLICATION_NAME).arg(Slicer_MAIN_PROJECT_VERSION_FULL);
      |                                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                          Slicer_MAIN_PROJECT_APPLICATION_NAME
make[5]: *** [Applications/MyAppApp/CMakeFiles/MyAppApp.dir/build.make:76: Applications/MyAppApp/CMakeFiles/MyAppApp.dir/Main.cxx.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:17646: Applications/MyAppApp/CMakeFiles/MyAppApp.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....

I found the definition in Slicer-build/vtkSlicerVersionConfigure.h but no include directives in header files included directly or indirectly by Main.cxx.

As the last change of the Main.cxx file in the template project is from July 2018, I’m quite puzzled and sure that I’m doing something wrong.

Can someone please point me into the right direction?

Thank you


1 Like

This could be related to the recent version macro refactoring. (Sorry I’m from phone now so will post link later)

Thanks to your hint, I found this commit:

As Applications/SlicerApp/Main.cxx is modified in that commit to have

+#include "vtkSlicerVersionConfigure.h" // For Slicer_VERSION_FULL

I guess that the same change should be applied to SlicerCustomAppTemplate/{{cookiecutter.project_name}}/Applications/{{cookiecutter.app_name}}App/Main.cxx.

Shall I create a pull request?

Thanks for your help!


@darabi and @cpinter Thanks for the investigative work :pray:

@darabi Could you review the following pull request:

I also added Co-authored-by: commit message trailers[1] to provide relevant credits, that said look like I incorrectly referenced your GitHub account, would you mind follow-up on that as well.

  1. Creating a commit with multiple authors - GitHub Docs ↩︎

LGTM, if you insist on including vtkSlicerConfigure.h (see comment)

1 Like

Thanks for the review :pray:

Changes have now been integrated :rocket:

For future reference, see KitwareMedical/SlicerCustomAppTemplate#53

Many thanks for the quick reaction. Is there any CI process testing the SlicerCAT build? I don’t find anything at (but I don’t even know if I should expect anything there :slight_smile: ).