How do I use a TASImage?

I have the following minimal C++ program and sledgehammer of a CMake file. The program compiles and links fine. If I uncomment the TASImage line, the program fails to link. What might I be doing wrong here? Do I need to add some kind of link library reference for libASImage maybe? If so what exactly and what do I need to download?

main.cpp

#include <TASImage.h>
#include <TCanvas.h>

int main(int argc, char* argv[]) {
    TCanvas* canvas = new TCanvas("canvas", "canvas");
    //TASImage* im = new TASImage(1,2);
    return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.9)
set(PROJECT_NAME TestRoot)
project (${PROJECT_NAME} CXX)

find_package(ROOT REQUIRED COMPONENTS Gui Core Imt 
RIO Net Hist Graf Graf3d Gpad ROOTDataFrame ROOTVecOps 
Tree TreePlayer Rint Postscript Matrix Physics MathCore 
Thread MultiProc)

include(${ROOT_USE_FILE})
set(CMAKE_CXX_FLAGS "${ROOT_CXX_FLAGS}")
include_directories(${ROOT_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})

set(SOURCES
main.cpp 
)
#ROOT_GENERATE_DICTIONARY(MainFrame_dict MainFrame.hpp LINKDEF LinkDef.h)
add_executable(${PROJECT_NAME} ${SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES ENABLE_EXPORTS 1)

target_link_libraries(${PROJECT_NAME} ROOT::Gui ROOT::Core ROOT::Imt
ROOT::RIO ROOT::Net ROOT::Hist ROOT::Graf ROOT::Graf3d ROOT::Gpad
ROOT::ROOTDataFrame ROOT::ROOTVecOps ROOT::Tree ROOT::TreePlayer
ROOT::Rint ROOT::Postscript ROOT::Matrix ROOT::Physics ROOT::MathCore
ROOT::Thread ROOT::MultiProc)

ROOT Version: 6.28.04
Platform: Ubuntu 22
Compiler: gcc 11.3.0


Yes, you need to add ROOT::ASImage to list of linked libraries.

Also if you want use TCanvas interactively, you need to add TApplication to your program.

Is there a list of sub-libraries in the ROOT:: namespace somewhere? The ones I can find online don’t include that one.

You can see library for the class at the very bottom of documentation page:

https://root.cern/doc/master/classTASImage.html

In case of cmake library name libASImage transformed into ROOT::ASImage.

You haven’t explicitly stated the pattern here but let me try to infer it.
You replace libXXX from the documentation with ROOT::XXX in your CMake file, based on the tree at the bottom of the documentation page.

Some ROOT::XXX values seem to cover multiple classes, for example TH1F has parent libHist, but I don’t need to include ROOT::Hist in my CMake file. The full list of .so files also varies between versions so searching there isn’t the answer either.

How do I determine what ROOT::XXX values contain which classes, e.g. ROOT::Core or ROOT::RIO

You need to check each class separately.

For TASImage class it is libASImage.
For TH1 class it is libHist and so on.

As far as I know, documentation does not provide list of classes in each library.
But may be @couet have more insight information about docu.

No, I not more informations to give. The list of libraries needed by a class is listed ate the end of the documention of that class.

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