Canvas is not displayed in ROOT based project with CMake!

I have created ROOT based project with CMake. When I run the program Canvas window is not opened. However, when I save the canvas c1->SaveAs(“test.png”) it saves correctly.
So how to make canvas to be opened?

CMakeList.txt

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(untitled1)

list(APPEND CMAKE_MODULE_PATH $ENV{ROOTSYS}/etc/cmake)
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})

find_package(ROOT REQUIRED COMPONENTS RooFitCore)

include_directories(${CMAKE_SOURCE_DIR} ${ROOT_INCLUDE_DIRS})

file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)

add_executable(untitled1 main.cpp ${sources} ${headers})
target_link_libraries(${PROJECT_NAME} ${ROOT_LIBRARIES})

ROOT Version: ROOT 6.14/04
Platform: Ubuntu 18.04.3 LTS
Compiler: gcc version 7.4.0


Does your program use TApplication ?
A bit like:

1 Like

Thank you very much.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.