Slot DoDraw() does not exist compiled guide

A ROOT program that utilizes Graphical User Interface (GUI) takes advantage of a Signal and Slot technology. In order for this technology to work in a stand-alone program it is not enough to simply compile your executable. On Linux and MacOS steps are following:

  • Create LinkDef.h file with list of classes utilizing Signals and Slots (example).
  • Use rootcling utility to generate dictionary (*.cxx and *.pcm) files from list of your headers and LinkDef.h
  • Compile shared library (.so) from your C++ source file(s) and dictionary .cxx file.
  • Compile your C++ source files into object files.
  • Link object files and shared library into executable.
  • Copy shared library *.so and dictionary *.pcm file to default system shared library search path ($DYLD_LIBRARY_PATH on macOS or $LD_LIBRARY_PATH on Linux).

Now you will be able to run the executable. Conventional way of automating the above steps is writing a Makefile. Below I attach an archive with your code and a universal GNU Makefile that will compile and install your program on MacOS or Linux.

kolev.zip (3.6 KB)

Please follow steps below to compile and run your program (on MacOS or Linux):

  • Unpack the archive, navigate inside the program folder containing Makefile.
  • In Terminal run make, followed by make install.
  • Run your program in Terminal by typing kolev

You can get familiar with the syntax of the above GNU Makefile in Chapter 6 of this manuscript.

Technically you can use Cmake to create a similar cross-platform Makefile for ROOT program that will compile and install your program on Windows computer as well. I do not have experience compiling ROOT stand-alone programs on Windows. Please refer to this post discussing options for ROOT Makefiles on Windows for more information.

1 Like