Why ACLiC does not like my conditionals?

Hi,

I have a simple class, TMyClass.h is[code]
#ifndef ROOT_TMyClass
#define ROOT_TMyClass

#ifndef ROOT_TObject
#include “TObject.h”
#endif

class TMyClass : public TObject {
TMyClass();
virtual ~TMyClass();
//#ifdef CINT
ClassDef(TMyClass,1)
//#endif
};
#endif[/code]
and TMyClass.c is

[code]#include “TMyClass.h”

ClassImp(TMyClass)

TMyClass::TMyClass(): TObject()
{
}
//______________________________________________________________________________
TMyClass::~TMyClass()
{
}[/code]

This form of class is correctly compiled:

[quote]root [62] .L TMyClass.c+
Info in TWinNTSystem::ACLiC: creating shared library C:\veghj\projects\root\ewa\TMyClass_c.dll
2353690_cint.cxx
s1pc_9c.cxx
Creating library C:\veghj\projects\root\ewa\TMyClass_c.lib and object C:\veghj\projects\root\ewa\TMyClass_c.exp[/quote]

BTW: if I try to compile without modification my class, I receive

[quote]root [63] .L TMyClass.c+
Info in : unmodified script has already been compiled and loaded[/quote]
if I modify the script, I receive

[quote]root [64] .L TMyClass.c+
Info in : modified script has already been compiled and loaded
Info in : it will be regenerated and reloaded![/quote]
I do not think the second message is correct: it is correctly noticed
that the script is modified, but at the time of loading it is surely not
compiled and loaded; and even if it is so: why to reload it after regenerating?

If I uncomment the directive "//#ifdef CINT "
I receive:[quote]
root [65] .L TMyClass.c+
Info in : modified script has already been compiled and loaded
Info in : it will be regenerated and reloaded!
Info in TWinNTSystem::ACLiC: creating shared library C:\veghj\projects\root\ewa\TMyClass_c.dll
2336110_cint.cxx
s1pc_9m.cxx
C:\veghj\projects\root\ewa\s1pc_9m.cxx(60) : error C2509: ‘Class_Name’ : member function not declared in 'TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(8) : see declaration of 'TMyClass’
C:\veghj\projects\root\ewa\s1pc_9m.cxx(66) : error C2509: ‘ImplFileName’ : member function not declared in 'TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(8) : see declaration of 'TMyClass’
C:\veghj\projects\root\ewa\s1pc_9m.cxx(72) : error C2509: ‘ImplFileLine’ : member function not declared in 'TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(8) : see declaration of 'TMyClass’
C:\veghj\projects\root\ewa\s1pc_9m.cxx(78) : error C2509: ‘Dictionary’ : member function not declared in 'TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(8) : see declaration of 'TMyClass’
C:\veghj\projects\root\ewa\s1pc_9m.cxx(84) : error C2509: ‘Class’ : member function not declared in 'TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(8) : see declaration of 'TMyClass’
C:\veghj\projects\root\ewa\s1pc_9m.cxx(91) : error C2509: ‘Streamer’ : member function not declared in 'TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(8) : see declaration of 'TMyClass’
C:\veghj\projects\root\ewa\s1pc_9m.cxx(103) : error C2509: ‘ShowMembers’ : member function not declared in 'TMyClass’
C:\veghj\projects\root\ewa\TMyClass.h(8) : see declaration of 'TMyClass’
C:\veghj\projects\root\ewa\s1pc_9m.cxx(115) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error in : Compilation failed![/quote]

As I understand, it is the net effect of the missing ClassDef(TMyClass,1)
i.e. the #ifdef works.
If I change it to #ifndef, I receive

[quote]
root [66] .L TMyClass.c+
Info in TWinNTSystem::ACLiC: creating shared library C:\veghj\projects\root\ewa\TMyClass_c.dll
21312110_cint.cxx
Error in : TMyClass inherits from TObject but does not have its own ClassDef
s1pc_9r.cxx
Creating library C:\veghj\projects\root\ewa\TMyClass_c.lib and object C:\veghj\projects\root\ewa\TMyClass_c.exp
s1pc_9r.obj : error LNK2001: unresolved external symbol “public: virtual void __thiscall TMyClass::Streamer(class TBuffer &)” (?Streamer@TMyClass@@UAEXAAVTBuffer@@@Z)
s1pc_9r.obj : error LNK2001: unresolved external symbol “public: virtual void __thiscall TMyClass::ShowMembers(class TMemberInspector &,char *)” (?ShowMembers@TMyClass@@UAEXAAVTMemberInspector@@PAD@Z)

s1pc_9r.obj : error LNK2001: unresolved external symbol “public: static class TClass * __cdecl TMyClass::Class(void)” (?Class@TMyClass@@SAPAVTClass@@XZ)
C:\veghj\projects\root\ewa\TMyClass_c.dll : fatal error LNK1120: 3 unresolved externals
Error in : Compilation failed![/quote]

I expected that in this second case the compilation will be OK,
but a different set of errors is produced. Why?

Janos

Hi,

[quote=“jvegh”]if I modify the script, I receive

[quote]root [64] .L TMyClass.c+
Info in : modified script has already been compiled and loaded
Info in : it will be regenerated and reloaded![/quote]
I do not think the second message is correct: it is correctly noticed
that the script is modified, but at the time of loading it is surely not
compiled and loaded; and even if it is so: why to reload it after regenerating?
[/quote]
See e.g. http://root.cern.ch/phpBB2/viewtopic.php?t=1974 why this is relevant info. You are right, though, that the info message is - well, at least not too clear. What it really means is: ROOT has already loaded a different version of the library you’re trying to load. ROOT will unload the old one (see the link for consequences), and compile and load your new one.

[quote=“jvegh”]If I uncomment the directive "//#ifdef CINT "…

I expected that in this second case the compilation will be OK,
but a different set of errors is produced. Why?
[/quote] Because both rootcint and the compiler need to see the CPP macro ClassDef. “ClassDef” expands to a number of methods - if you hide the macro call, these methods will be missing (decls for CINT with #ifdef CINT, impls for the linker with #ifndef CINT).
Axel.

Hi,

[quote=“jvegh”]If I uncomment the directive "//#ifdef CINT "…

I expected that in this second case the compilation will be OK,
but a different set of errors is produced. Why?
[/quote=Axel] Because both rootcint and the compiler need to see the CPP macro ClassDef. “ClassDef” expands to a number of methods - if you hide the macro call, these methods will be missing (decls for CINT with #ifdef CINT, impls for the linker with #ifndef CINT).
Axel.[/quote]

I agree that if “ClassDef” is not present, there must be an error
and some error messages should come.

I say again:
if no #ifdef/#ifndef is present, the class compiles fine.
If I remove “ClassDef”, I receive one set of errors.
If I put “ClassDef” behind #ifdef, I receive a second set of errors.
If I put “ClassDef” behind #ifdef, I received a third set of errors.
What I expected, it was that in one of the last two cases the script
should compile fine. Instead, I receive a third set of error messages.

If other words: I guess that the preprocessor directive #if(n)def
interferes with the macro expansion. This is the main point.

Janos

Hi,
no - it’s simply needed by both CINT and the compiler. Without any ifdef things work, with #ifndef CINT cint can’t see the ClassDef, with #ifdef CINT the compiler can’t see it.

Either way - what’s your point? You know how to do it right, why do you try so hard to get it wrong?
Axel.

[quote=“Axel”]
Either way - what’s your point? You know how to do it right, why do you try so hard to get it wrong?
Axel.[/quote]
You know, my experience is that about 80 % of my time spent with ROOT went to discover undocumented features, hidden extensions, bugs like this, deviations from the standard, inapropriate warning and error messages, etc. Maybe with the routine you have I would not discover any of them, because I would know what is wrong and unusable.

Without this routine I say that the developer tools must be as completely debugged as possible. My point was to point out that either the macro or the preprocessor is wrong. If I did it wrong, sorry for it.

Regards

Janos

Well, let us know about the bugs you encounter! This is not a bug, though. You cannot hide the dictionary method declarations from the dictionary generator (#ifndef CINT), nor can you hide it from the compiler (#ifdef CINT). Both need to be able to see them.

Easy. You are writing improper code; there’s not much ROOT can do. There is nothing wrong with ROOT here, it’s just not that good at magically fixing broken code…

Nope, and I believe I’ve explained why. The developer tools are in wide use, so they are “as completely debugged as opssible”. If you find problems on valid code, which are not mentioned in the CINT limitations, then please let us know.
Cheers, Axel.

Well, I think that if the code fragments

MyCommand()

#if true MyCommand() #endif

#if false MyCommand() #endif
produce 3 different results (rather than 2) is exactly such a case. If not or it is one of the cases “mentioned in the CINT limitations”, I beg your pardon.

Regards

Janos

Hi,
okay, now we’re getting somewhere :slight_smile: 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=“Axel”]Hi,
okay, now we’re getting somewhere :slight_smile: 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]

[quote=“jvegh”][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’…
[/quote]
Which, I think, has not too much to do with my code.[/quote]
Right, see http://root.cern.ch/phpBB2/viewtopic.php?t=1959.

[quote=“jvegh”]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[/quote][/quote]I cannot reproduce this with the code you sent. For me it just works:

root [0] .L TMyClass.c root [1]
Note, though, that a C++ source file should not have a C source file extension (.c). Better call it TMyClass.C or .cpp or .cxx.

On deriving from TObject: the main problem with interpreted classes (as in “.L TMyClass.C”) deriving from compiled classes (like TObject) is Cint’s inability to call the proper virtual function. I.e. you’re fine as long as you don’t re-implement one of TObject’s virtual functions in your derived class, and call it via a TObject* or TObject&. The common approach is to always compile your code (as in “.L TMyClass.C+”), except for simple scripts (e.g. for steering analysis code etc).

Cheers, Axel.

After the information I found on the VC-related pages you sent
in connection with 7.1, it is surprising. I personally think that
a version check would be sufficient. Or at least a version check
with a #error

[quote=“Axel”]The common approach is to always compile your code (as in “.L TMyClass.C+”)
[/quote]
I would. But it looks like that if my code works with CINT,
compiles with the native compiler which is called by ACLiC,
is not enough. This is one more factor I am wasting my time with

Janos

Hi,

[quote=“jvegh”]But it looks like that if my code works with CINT,
compiles with the native compiler which is called by ACLiC,
is not enough. This is one more factor I am wasting my time with[/quote]Why is that “not enough”? It doesn’t mean your code works (just because code compiles doesn’t mean it makes sense) - but apart from that…

Again: use a supported compiler, and build and load your library with “.L TMyClass.C+”. If you are “wasting your time” on a problem with this approach (which is related to ROOT) then let us know the details, so we can reproduce it. Have a look at $ROOTSYS/test/Event.h for what a class should look like. But your TMyClass already looks good to me.
Axel.

[quote=“Axel”][quote]Hi,

[quote=“jvegh”]But it looks like that if my code works with CINT,
compiles with the native compiler which is called by ACLiC,
is not enough. This is one more factor I am wasting my time with[/quote]Why is that “not enough”? It doesn’t mean your code works (just because code compiles doesn’t mean it makes sense) - but apart from that…
[/quote]
Well, last time you told that with my program I am testing the native compiler and linker, ACLiC adds nothing. Now I say: The code compiles fine with the native compiler (probably the same version, which is also called by ACLiC), but not with ACLiC

[quote=“Axel”]
Again: use a supported compiler, and build and load your library with “.L TMyClass.C+”. If you are “wasting your time” on a problem with this approach (which is related to ROOT) then let us know the details, so we can reproduce it. Have a look at $ROOTSYS/test/Event.h for what a class should look like. But your TMyClass already looks good to me.
Axel.[/quote][/quote]

OK, Ill upgrade my compiler. But, I keep my opinion that this simple class should compile (or not compile) when calling directly or by ACLiC.
I am sorry I cannot give more details. The test/tutorials run, I sent the source file and the error messages, so what else do you need? Shall I also send an MS VC 6 compiler CD? (sorry)
I also think that my class sould compile. And, it does with cl.
And yes, I am wasting my time with experimenting what and where and why could be wrong. And the error messages do not support me. Neither you.

Thanks for your efforts.

Janos

Janos,

Giving the fact that all your “failing” examples work correctly with a decent compiler (VC++7.1) or with the CVS head (it includes an ifdef
to bypass the C++6 compiler bug), and to avoid that you, Axel and me
waist time in a sterile debate, I suggest that you follow Axel’s advice
in upgrading your compiler.

Concerning your point with ACLIC and the compiler:
When you compile with ACLIC, there is additional code generated
by ACLIC to call the compiled code from the interpreted code.

Rene

[code]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’

[/code]
This was correct in the CVS head a couple of weeks ago.

c:\root/include\TDatime.h(86) : error C2248: 'fDatime' : cannot access protected member declared in class 'TDatime'If I remember correctly this is a bug in VC6 you need to use the latest patch for VC6.

Philippe.

Hi Janos,

I confirm you have to install service pack for MSVC6.
FYI, see :
root.cern.ch/phpBB2/viewtopic.php?t=1661&start=0

Cheers,
Bertrand.