RE: Problem creating dictionaries of classes which contain Qt-class-members

From: Faine, Valeri <fine_at_bnl.gov>
Date: Tue, 3 May 2005 10:37:45 -0400


Dear Katharina Ehrhardt

You can not use the method

  QString getName()const;

of your class

Because there is no RootCint dictionary for QString class yet. By the same reason, QString object is no use under CINT interpreter. As a work around you may try to change your class as follows:

#ifndef __CINT__
# include <qstring.h>
#else

  class QString;
#endif

#include <TObject.h>

#ifndef __CINT__
# include <qstring.h>
#else

  class QString;
#endif

#include <TObject.h>

using namespace std;
class mySmallClass:public TObject
{
 private:

#ifndef __CINT__

  QString name; //!
#endif

  int data;
 public:
  mySmallClass(const QString& n,int d=0);   ~mySmallClass();
  int getData()const;
  QString &getName()const;
  void setData(int d);
  ClassDef(mySmallClass,2)
};

in addition you should define your LinkDef.h header file

LinkDef.h:



#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class mySmallClass;
#endif

With the corrections above, I did succeed to build to RootCint dictionary for your class as follows:

rootcint myClassDict.cxx -c myClass.h LinkDef.h

Hope this helps.



Best regards
                   Valeri

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Katharina Ehrhardt
Sent: Tuesday, May 03, 2005 9:31 AM
To: roottalk
Subject: [ROOT] Problem creating dictionaries of classes which contain Qt-class-members

Hi all
I've encountered a problem in creating dictionaries for header files which include a Qt header file.
> $ROOTSYS/bin/rootcint -f mySmallClassDict.cpp -c -I$QTDIR/include mySmallClass.h mySmallClassLinkDef.h
Error: Illegal pointer operation (tovalue) FILE:/opt/qt-3.3.2-gcc3/include/qglobal.h LINE:148 Error: operator '/' divided by zero
FILE:/opt/qt-3.3.2-gcc3/include/qglobal.h LINE:148 Syntax Error: defined(_SCO_DS)/*SCOOpenServer5+GCC*/ FILE:/opt/qt-3.3.2-gcc3/include/qglobal.h LINE:148 Error: Illegal pointer operation (tovalue) FILE:/opt/qt-3.3.2-gcc3/include/qglobal.h LINE:150 Error: operator '/' divided by zero

FILE:/opt/qt-3.3.2-gcc3/include/qglobal.h LINE:150
Syntax Error: defined(__USLC__)/*allSCOplatforms+UDKorOUDK*/
FILE:/opt/qt-3.3.2-gcc3/include/qglobal.h LINE:150
Error: Illegal pointer operation (tovalue) FILE:/opt/qt-3.3.2-gcc3/include/qglobal.h LINE:153 Syntax Error: defined(__svr4__)&&defined(i386)/*OpenUNIX8+GCC*/ FILE:/opt/qt-3.3.2-gcc3/include/qglobal.h LINE:153
#error "Qt has not been ported to this OS - talk to qt-bugs_at_trolltech.com"
Error: Function :data(0) is not defined in current scope  FILE:/opt/qt-3.3.2-gcc3/include/qgarray.h LINE:116 Possible candidates are...
filename       line:size busy function type and name  Error: Symbol {}char is not defined in current scope  FILE:/opt/qt-3.3.2-gcc3/include/qgarray.h LINE:116 Error: Function len(0){}char is not defined in current scope  FILE:/opt/qt-3.3.2-gcc3/include/qgarray.h LINE:116 Possible candidates are...
filename       line:size busy function type and name  Error: Function data;uintlen;};QGArray( is not defined in current scope  FILE:/opt/qt-3.3.2-gcc3/include/qgarray.h LINE:116 Possible candidates are...
filename       line:size busy function type and name  Limitation: length of one function argument be less than 1024 FILE:/opt/qt-3.3.2-gcc3/include/qgarray.h LINE:116 Use temp variable as workaround.
Error: improper lvalue FILE:/opt/qt-3.3.2-gcc3/include/qgarray.h LINE:116 Error: class,struct,union or type QGArray not defined  FILE:/opt/qt-3.3.2-gcc3/include/qgarray.h LINE:119 Error: class,struct,union or type QGArray not defined  FILE:/opt/qt-3.3.2-gcc3/include/qmemarray.h LINE:48 Segmentation fault (core dumped)
I'm especially unhappy with the line:#error "Qt has not been ported to this OS - talk to qt-bugs_at_trolltech.com"

and my header file looks like:
#include <qstring.h>
#include <TObject.h>

using namespace std;
class mySmallClass:public TObject
{

 private:
  QString name;  //!
  int data;
 public:
  mySmallClass(const QString& n="",int d=0);
  ~mySmallClass();
  int getData()const;
  QString getName()const;
  void setData(int d);
  ClassDef(mySmallClass,2)

};

Greetings
Katharina Ehrhardt Received on Tue May 03 2005 - 16:37:56 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET