Hello.
I create TCanvas with a TGraph and write it into a root file:
TFile file("filename.root", "recreate");
TCanvas canvas("canvas", "", 1920, 1080);
TGraph graph;
graph.SetNameTitle("zenith", "zenith");
canvas.Divide(2, 2);
canvas.cd(1);
graph.Draw("AC*");
canvas.Update();
canvas.Write();
If I use it in a ROOT macro script, everything is ok.
But if I do it in compiled program then I can’t draw this canvas in the ROOT interpreter because of errors:
root [2] canvas->Draw()
*** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCore.so] TList::FindObject(char const*) const (no debug info)
[/Users/bair/Projects/root/root_install/lib/libGpad.so] TPad::FindObject(char const*) const (no debug info)
[/Users/bair/Projects/root/root_install/lib/libGpad.so] TPad::FindObject(char const*) const (no debug info)
[/Users/bair/Projects/root/root_install/lib/libGpad.so] TPad::UseCurrentStyle() (no debug info)
[/Users/bair/Projects/root/root_install/lib/libGpad.so] TCanvas::UseCurrentStyle() (no debug info)
[/Users/bair/Projects/root/root_install/lib/libRIO.so] TKey::ReadObj() (no debug info)
[/Users/bair/Projects/root/root_install/lib/libRIO.so] TDirectoryFile::Get(char const*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCore.so] TROOT::FindSpecialObject(char const*, void*&) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] TCling::GetObjectAddress(char const*, void*&) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] TClingCallbacks::tryFindROOTSpecialInternal(clang::LookupResult&, clang::Scope*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] TClingCallbacks::LookupObject(clang::LookupResult&, clang::Scope*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] cling::MultiplexInterpreterCallbacks::LookupObject(clang::LookupResult&, clang::Scope*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::MultiplexExternalSemaSource::LookupUnqualified(clang::LookupResult&, clang::Scope*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Sema::LookupName(clang::LookupResult&, clang::Scope*, bool) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Sema::ClassifyName(clang::Scope*, clang::CXXScopeSpec&, clang::IdentifierInfo*&, clang::SourceLocation, clang::Token const&, clang::CorrectionCandidateCallback*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::TryAnnotateName(clang::CorrectionCandidateCallback*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributesWithRange&) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::ParseCompoundStatementBody(bool) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] cling::IncrementalParser::ParseInternal(llvm::StringRef) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] cling::Interpreter::EvaluateInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] cling::Interpreter::process(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, cling::Value*, cling::Transaction**, bool) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCling.so] TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libRint.so] TRint::ProcessLineNr(char const*, char const*, int*) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libRint.so] TRint::HandleTermInput() (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCore.so] TUnixSystem::CheckDescriptors() (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCore.so] TMacOSXSystem::DispatchOneEvent(bool) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCore.so] TSystem::InnerLoop() (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCore.so] TSystem::Run() (no debug info)
[/Users/bair/Projects/root/root_install/lib/libCore.so] TApplication::Run(bool) (no debug info)
[/Users/bair/Projects/root/root_install/lib/libRint.so] TRint::Run(bool) (no debug info)
[/Users/bair/Projects/root/root_install/bin/root.exe] main (no debug info)
[/usr/lib/dyld] start (no debug info)
If I remove the line: graph.SetNameTitle("zenith", "zenith»);
it works again.
It’s strange behaviour, why don’t I change name of the graph (I want to use the graph name in the interpreter)?
Thanks,
Bair
ROOT Version: 6.30/02
Platform: MacOS
Compiler: clang 15.0.0