[quote=“Axel”]Hi,
okay, now we’re getting somewhere CINT is not always undefined when building your shared library. It’s defined when generating the dictionary (which is part of the build process when running “.L myMacro.C+”), but it’s 0 when the compiler reads your macro. That’s where the inconsistency comes from, whether you do #ifdef or #ifndef.
Axel.[/quote]
OK, thanks for this info. And, I explain why do I need this.
The documentation is pretty controversary and incomplete. Even in the very basic things.
For example,
but
[quote]There are some limitations for a class created in a script:
1./ They cannot inherit from TObject.[/quote]
What is then the way to debug TObject-derived classes? Is it discussed somewhere?
In my eyes the cited sentences mean that if I derive my object from TObject, I cannot try it out with CINT. I experienced (see my posts to the list, this one and CINT support) that CINT does not interpret the member function definitions (it is an “undocumented extension”, towards C++ standard!) so in a systematic development I do need to compile my class periodically.
In addition, CINT debug ability is being far from those of the modern visual debuggers, so I want to use my Visual C++ for debugging and writing the code (it does not lock my script and data files, warns if I make syntactic errors, omit or wrongly type a parameter, etc.) To do this, I need conditionals which suppress using ClassDef&Co.
The sample I sent works OK with VC, works with CINT but not with ACLiC.
Now I understand why. The compilation implies different actions.
Is there any source around how a class I want to add to ROOT shall look like? The compiler shows a wild behaviour. Having the files
[code]#ifndef ROOT_TMyClass
#define ROOT_TMyClass
#include “TObject.h”
class TMyClass
: public TObject
{
public:
TMyClass();
virtual ~TMyClass();
ClassDef(TMyClass,1)
};
#endif
[/code]
and
[code]#include “T1.h”
#include <stdio.h>
ClassImp(TMyClass)
TMyClass::TMyClass()
: TObject()
{
printf(“constructed\n”);
}
//______________________________________________________________________________
TMyClass::~TMyClass()
{
printf(“destructed\n”);
}[/code]
the code runs fine with CINT, without the ClassDef, ClassImp, etc. stuff runs fine with MS VC, while with ACLiC gives output
[quote]root [1] .L T1.c+
Info in TWinNTSystem::ACLiC: creating shared library C:\veghj\projects\root\ewa\T1_c.dll
250046_cint.cxx
s2ao_5.cxx
c:\root/include\TString.h(408) : error C2039: ‘atoi’ : is not a member of ‘std’
c:\root/include\TString.h(411) : error C2039: ‘atof’ : is not a member of ‘std’
c:\root/include\TDatime.h(86) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(86) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(88) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(88) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(90) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(90) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(92) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(92) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(94) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(94) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(96) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(96) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
Error in : Compilation failed![/quote]
Which, I think, has not too much to do with my code.
Another case:
[code]#ifndef ROOT_TMyClass
#define ROOT_TMyClass
#if defined(MAKECINT)
#include “TObject.h”
#endif
class TMyClass
#if defined(MAKECINT)
: public TObject
#endif
{
public:
TMyClass();
virtual ~TMyClass();
#if defined(CINT) || defined(MAKECINT)
ClassDef(TMyClass,1)
#endif
};
#endif[/code]
and
[code]#include “TMyClass.h”
#include <stdio.h>
#if defined(CINT) || defined(MAKECINT)
ClassImp(TMyClass)
#endif
TMyClass::TMyClass()
#if defined(MAKECINT)
: TObject()
#endif
{
int A[5][10];
for(int i = 0; i < 5; i++)
for(int j = 0; j<5; j++)
A[i][j] = i*100+j;
for( i = 0; i < 5; i++)
{
for( int j = 0; j<5; j++)
printf(“%6d”, A[i][j]);
printf(“\n”);
}
printf(“\n”);
}
//______________________________________________________________________________
TMyClass::~TMyClass()
{
}
#if !defined(MAKECINT) && !defined(CINT)
main()
{
TMyClass M;
return 0;
}
#endif
[/code]
results in
root [6] .L TMyClass.c
reloading C:\veghj\projects\root\ewa\TMyClass.c 0
reloading TMyClass.h 0
reloading stdio.h 0
reloading stdfunc.dll 0
root [7] TMyClass M
0 1 2 3 4
100 101 102 103 104
200 201 202 203 204
300 301 302 303 304
400 401 402 403 404
in the same way as tne MS VC case
[quote]C:\veghj\projects\root\ewa>cl TMyClass.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
TMyClass.cpp
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:TMyClass.exe
TMyClass.obj
C:\veghj\projects\root\ewa>tmyclass
0 1 2 3 4
100 101 102 103 104
200 201 202 203 204
300 301 302 303 304
400 401 402 403 404[/quote]
If I change the dimension to A[5][1000], the MS VC case is OK,
while in the case of CINT I receive
[quote]root [5] .L TMyClass.c
Warning: s() Missing ‘;’ FILE:C:\veghj\projects\root\ewa\TMyClass.c LINE:27
Error: Too many ‘}’ FILE:C:\veghj\projects\root\ewa\TMyClass.c LINE:28
reloading C:\veghj\projects\root\ewa\TMyClass.c 0
Error: Symbol u is not defined in current scope FILE:c:\root\cint\include\stdio.h LINE:11
reloading TMyClass.h 0
reloading stdio.h 0
reloading stdfunc.dll 0[/quote]
At the same time, at any dimension, ACliC said
[quote]root [9] .L TMyClass.c+
Info in : script has already been loaded in interpreted mode
Info in : unloading C:\veghj\projects\root\ewa\TMyClass.c and compiling it
Info in TWinNTSystem::ACLiC: creating shared library C:\veghj\projects\root\ewa\TMyClass_c.dll
2261246_cint.cxx
s2ao_a.cxx
c:\root/include\TString.h(408) : error C2039: ‘atoi’ : is not a member of ‘std’
c:\root/include\TString.h(411) : error C2039: ‘atof’ : is not a member of ‘std’
c:\root/include\TDatime.h(86) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(86) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(88) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(88) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(90) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(90) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(92) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(92) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(94) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(94) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(96) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
c:\root/include\TDatime.h(96) : error C2248: ‘fDatime’ : cannot access protected member declared in
class ‘TDatime’
c:\root/include\TDatime.h(32) : see declaration of ‘fDatime’
C:\veghj\projects\root\ewa\s2ao_a.cxx(50) : error C2039: ‘Class_Version’ : is not a member of ‘TMyCl
ass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(50) : error C2065: ‘Class_Version’ : undeclared identifier
C:\veghj\projects\root\ewa\s2ao_a.cxx(52) : error C2039: ‘Dictionary’ : is not a member of 'TMyClass
’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(52) : error C2065: ‘Dictionary’ : undeclared identifier
C:\veghj\projects\root\ewa\s2ao_a.cxx(66) : error C2039: ‘fgIsA’ : is not a member of ‘TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(69) : error C2039: ‘Class_Name’ : is not a member of 'TMyClass
’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(75) : error C2039: ‘ImplFileName’ : is not a member of ‘TMyCla
ss’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(81) : error C2039: ‘ImplFileLine’ : is not a member of ‘TMyCla
ss’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(87) : error C2039: ‘Dictionary’ : is not a member of 'TMyClass
’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(88) : error C2373: ‘Dictionary’ : redefinition; different type
modifiers
C:\veghj\projects\root\ewa\s2ao_a.cxx(93) : error C2039: ‘Class’ : is not a member of ‘TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(100) : error C2039: ‘Streamer’ : is not a member of ‘TMyClass’
C:\\veghj\\projects\\root\\ewa\\TMyClass.h(12) : see declaration of 'TMyClass'
C:\veghj\projects\root\ewa\s2ao_a.cxx(105) : error C2039: ‘Class’ : is not a member of ‘TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(105) : error C2673: ‘Streamer’ : global functions do not have
‘this’ pointers
C:\veghj\projects\root\ewa\s2ao_a.cxx(107) : error C2039: ‘Class’ : is not a member of ‘TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(107) : error C2673: ‘Streamer’ : global functions do not have
‘this’ pointers
C:\veghj\projects\root\ewa\s2ao_a.cxx(112) : error C2039: ‘ShowMembers’ : is not a member of ‘TMyCla
ss’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(117) : error C2039: ‘IsA’ : is not a member of ‘TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(117) : error C2065: ‘IsA’ : undeclared identifier
C:\veghj\projects\root\ewa\s2ao_a.cxx(117) : error C2440: ‘initializing’ : cannot convert from ‘int’
to ‘class TClass *’
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or fun
ction-style cast
C:\veghj\projects\root\ewa\s2ao_a.cxx(120) : error C2352: ‘TObject::ShowMembers’ : illegal call of n
on-static member function
c:\root/include\TObject.h(190) : see declaration of ‘ShowMembers’
C:\veghj\projects\root\ewa\s2ao_a.cxx(126) : error C2039: ‘IsA’ : is not a member of ‘TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(221) : error C2039: ‘Class’ : is not a member of ‘TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(226) : error C2039: ‘Class_Name’ : is not a member of ‘TMyClas
s’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(231) : error C2039: ‘Class_Version’ : is not a member of ‘TMyC
lass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(237) : error C2039: ‘Dictionary’ : is not a member of ‘TMyClas
s’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(242) : error C2039: ‘IsA’ : is not a member of ‘TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(248) : error C2039: ‘ShowMembers’ : is not a member of ‘TMyCla
ss’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(254) : error C2039: ‘Streamer’ : is not a member of ‘TMyClass’
C:\\veghj\\projects\\root\\ewa\\TMyClass.h(12) : see declaration of 'TMyClass'
C:\veghj\projects\root\ewa\s2ao_a.cxx(260) : error C2039: ‘StreamerNVirtual’ : is not a member of ‘T
MyClass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(265) : error C2039: ‘DeclFileName’ : is not a member of ‘TMyCl
ass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(265) : error C2065: ‘DeclFileName’ : undeclared identifier
C:\veghj\projects\root\ewa\s2ao_a.cxx(270) : error C2039: ‘ImplFileLine’ : is not a member of ‘TMyCl
ass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(275) : error C2039: ‘ImplFileName’ : is not a member of ‘TMyCl
ass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(280) : error C2039: ‘DeclFileLine’ : is not a member of ‘TMyCl
ass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(280) : error C2065: ‘DeclFileLine’ : undeclared identifier
C:\veghj\projects\root\ewa\s2ao_a.cxx(451) : error C2039: ‘Class’ : is not a member of ‘TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(452) : error C2039: ‘Class_Name’ : is not a member of ‘TMyClas
s’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(453) : error C2039: ‘Class_Version’ : is not a member of ‘TMyC
lass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(454) : error C2039: ‘Dictionary’ : is not a member of ‘TMyClas
s’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(460) : error C2039: ‘DeclFileName’ : is not a member of ‘TMyCl
ass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(461) : error C2039: ‘ImplFileLine’ : is not a member of ‘TMyCl
ass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(462) : error C2039: ‘ImplFileName’ : is not a member of ‘TMyCl
ass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
C:\veghj\projects\root\ewa\s2ao_a.cxx(463) : error C2039: ‘DeclFileLine’ : is not a member of ‘TMyCl
ass’
C:\veghj\projects\root\ewa\TMyClass.h(12) : see declaration of ‘TMyClass’
Error in : Compilation failed![/quote]
This is why I say that I am wasting most of my time with this development system.
Janos
[quote]