Bug in invocation of namespace in Root

I have a .hh file

#ifndef _testdef_hh_
#define _testdef_hh_

namespace testdef
  //extern const int testi;                                                                                                                                                      
  void testDo();

void someDo();


.cc file

#include "testdef.hh"
#include <stdio.h>
//const int testdef::testi = 5;                                                                                                                                                  
void testdef::testDo()
  printf("Hi! I am testdef::testDo()\n");

void someDo()
   printf("Hi! I am someDo()\n");


and a linkdef file


/ some C++ header definition                                                                                                                                                    
#ifdef __MAKECINT__
// turns off dictionary generation for all                                                                                                                                       
#pragma link off all class;
#pragma link off all function;

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link off all namespaces;
#pragma link C++ namespace testdef;
//#pragma link C++ const int testdef::testi;                                                                                                                                     
#pragma link C++ function testdef::testDo();
#pragma link C++ function someDo();

In cling

root -l
executing /afs/cern.ch/work/v/vveckaln/private/CMSSW_9_4_11/src/TopLJets2015/TopAnalysis/rootlogon.C
root [0] testdef::testDo()
ROOT_prompt_0:1:1: error: 'testdef' is not a class, namespace, or enumeration
ROOT_prompt_0:1:1: note: 'testdef' declared here
root [1] someDo()
Hi! I am someDo()
root [2] testdef::testDo()
Hi! I am testdef::testDo()

one sees that calling someDo() wakes up testdef::testDo(). Where is the bug?

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

By using a testfunc() I can also “wake up” Definitions::WorkEnum_t described in Add enum class in namespace to Root - #7 by Viesturs

This isn’t a normal workflow.

If I do

cat lib/testdef.rootmap    
[  ]
# List of selected namespaces
namespace testdef

why I don’t see someDo() and namespace testdef members?

Only, classes and namespace are listed in the rootmap file. In newer version of ROOT, the rootmap files have been deprecated and replaced by a search through the available libraries.

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