"Error: macro ORTHANC_ENABLE_LOGGING_PLUGIN must be defined" in Orthanc sample MicroService


I try to fine-tune my CMakeList.txt files for different Orthanc projects developed inside a Debian Docker container.
I have troubles to set up a correct environment using the Orthanc framework and the C++ wrapper.

In the Orthanc source code is a sample showing how to create a simple Web service in C++ using the Orthanc standalone framework.


I tried to build this example without changes in the Debian container with the commands


Here is the result:


This is the same sort of problem that I experience in my own projects.
I tried different ways to define the macro ORTHANC_ENABLE_LOGGING_PLUGIN, without success.
I don’t understand why this macro is needed in a sample which is not a plugin ?

Thank you for your help.

Marco Barnig

If you define HAS_ORTHANC_EXCEPTION to 0 with add_definitions(-DHAS_ORTHANC_EXCEPTION=0), the OrthancException.h file will not be included, and, in turn, the Logging.h file from Orthanc will not be included.

You will still be able to log using the OrthancPluginLogError, OrthancPluginLogWarning… functions from the Orthanc C Plugin SDK.

What these logging macro such as ORTHANC_ENABLE_LOGGING_PLUGIN provide is syntactic sugar on top of the C functions (with a stream-like syntax in C++). And, in order to make sure the user gets what he wants, these macro have to be defined, but their mere definition does not control the way the logging works. It’s their value that’s important. That’s the way Sebastien designed the preprocessor logic (making configuration explicit).

Please let me know if this helps. We can drill further in the cmake files if I got something wrong and it doesn’t work out.


Dear Benjamin,

thank you for your quick answer. Your precisions helped me to progress.
I added


in the CMakeLists.txt file, but the compiler was still requesting the definition of the macro ORTHANC_ENABLE_LOGGING_PLUGIN.

After adding also the definition -DORTHANC_ENABLE_LOGGING_PLUGIN=0 to the cmake file, the error disappeared.

However another error appeared : # ZLIB support must be enabled.


I tried several settings, without success.

My best guess is to set(ORTHANC_ENABLE_ZLIB ON) or set(ORTHANC_ENABLE_ZLIB 1) in the CMaleLists.txt file, without success.
Now I am stuck again and need your help.

Here is the complete modified Orthanc/Resources/Samples/OrthancFramework/MicroService/CMakeLists.txt file:


The sample file is not directly related to my RadioLogic project, I run it to understand the whole Orthanc building process.

I will now dive deeper in the macro ORTHANC_ENABLE_LOGGING_PLUGIN because I use the “syntactic sugar” a lot in my RadioLogicCreator plugin.
I was able to build the plugin because I use an adapted CMakeLists.txt file, assembled from the DicomWeb, WebViewer and Transfer plugins.
I want now to better understand the building process with Cmake.

I am looking forward to meet you in Liège in the Orthanc Technical Workshop.

best regards,

Marco Barnig


According to your previous message, you actually want to reuse some files from the Orthanc source code into another project (in your case, an Orthanc plugin).

In such a case, you should have a look at the 2 following files, that automate the inclusion of all the required CMake files together with the definition of the proper CMake variables:


Here is a minimalist example of a CMakeLists.txt that uses this so-called “Orthanc framework”:


set(ORTHANC_ROOT /home/jodogne/orthanc)




add_definitions(-DORTHANC_ENABLE_LOGGING_PLUGIN=0) # Use “1” if you are building a plugin

add_executable(Test Test.cpp ${ORTHANC_CORE_SOURCES})

Between the inclusion of “OrthancFrameworkParameters.cmake” and “OrthancFrameworkConfiguration.cmake”, you can enable optional components of the Orthanc framework (such as zlib, libjpeg or DCMTK). The available optional components are listed at the bottom of “OrthancFrameworkParameters.cmake”.


Dear Sébastien,

thank you very much for your hints.
Now it made click in my brain.
Shame on me.
Everything was in front of my eyes in the /OrthancFramework/MicroService/ example and I didn’t see that the two files “OrthancFrameworkParameters.cmake” and “OrthancFrameworkConfiguration.cmake” contain all the missing information.
It seems very ingenious to me. I think after exploring the content of these files in detail during this weekend I should be able to understand the whole building process.
I will keep you informed about my progress.

Thank you again and best regards



In my thread https://groups.google.com/forum/#!searchin/orthanc-users/barnig%7Csort:date/orthanc-users/7f7HVGiocnY/jvTXQC98AAAJ I announced the creation of a public Github repository to share the RadioLogic code with the community and to describe my plugin development in the related Wiki. As usual, it takes more time as I imagined to do it, but it will be ready before the conference. Everything I learned the last days will be included in the small tutorial in the Wiki.

Hi Marco

Glad to read that you were able to fix your issues.

Great news for your proposal to share your code. This will nicely complement my presentation about writing a (simple) plugin.

Looking forward to meet you, too!