Problem 1454

Summary: fatal error: qobject.h: No such file or directory compilation terminated. In Several Applications.
Product: Geant4 Reporter: Martin McHugh <mjmchugh>
Component: configAssignee: Ben Morgan <Ben.Morgan>
Status: CLOSED FIXED    
Severity: normal CC: lintao51
Priority: P5    
Version: 9.5   
Hardware: PC   
OS: Linux   

Description Martin McHugh 2013-03-06 23:29:07 CET
Hello,

I hope you can help me. 

The following is the error message for trying to compile example N04. I've encountered the same error when trying to compile my own application.

mjmchugh:~$ pwd
/home/mjmchugh/Geant4/geant4.9.5.p01/examples/novice/N04
mjmchugh:~$ make
Making dependency for file exampleN04.cc ...
/home/mjmchugh/Geant4/geant4.9.5.p01/source/interfaces/basic/include/G4UIQt.hh:40:21: fatal error: qobject.h: No such file or directory
compilation terminated.
Making dependency for file src/ExN04TrackingAction.cc ...
Making dependency for file src/ExN04TrackerSD.cc ...
Making dependency for file src/ExN04TrackerParametrisation.cc ...
Making dependency for file src/ExN04TrackerHit.cc ...
Making dependency for file src/ExN04SteppingVerbose.cc ...
Making dependency for file src/ExN04SteppingAction.cc ...
Making dependency for file src/ExN04StackingActionMessenger.cc ...
Making dependency for file src/ExN04StackingAction.cc ...
Making dependency for file src/ExN04RunAction.cc ...
Making dependency for file src/ExN04PrimaryGeneratorMessenger.cc ...
Making dependency for file src/ExN04PrimaryGeneratorAction.cc ...
Making dependency for file src/ExN04MuonSD.cc ...
Making dependency for file src/ExN04MuonHit.cc ...
Making dependency for file src/ExN04Field.cc ...
Making dependency for file src/ExN04EventAction.cc ...
Making dependency for file src/ExN04DetectorConstruction.cc ...
Making dependency for file src/ExN04CalorimeterSD.cc ...
Making dependency for file src/ExN04CalorimeterROGeometry.cc ...
Making dependency for file src/ExN04CalorimeterParametrisation.cc ...
Making dependency for file src/ExN04CalorimeterHit.cc ...
Making dependency for file exampleN04.cc ...
/home/mjmchugh/Geant4/geant4.9.5.p01/source/interfaces/basic/include/G4UIQt.hh:40:21: fatal error: qobject.h: No such file or directory
compilation terminated.
Compiling ExN04CalorimeterHit.cc ...
Compiling ExN04CalorimeterParametrisation.cc ...
Compiling ExN04CalorimeterROGeometry.cc ...
Compiling ExN04CalorimeterSD.cc ...
Compiling ExN04DetectorConstruction.cc ...
Compiling ExN04EventAction.cc ...
Compiling ExN04Field.cc ...
Compiling ExN04MuonHit.cc ...
Compiling ExN04MuonSD.cc ...
Compiling ExN04PrimaryGeneratorAction.cc ...
Compiling ExN04PrimaryGeneratorMessenger.cc ...
Compiling ExN04RunAction.cc ...
Compiling ExN04StackingAction.cc ...
Compiling ExN04StackingActionMessenger.cc ...
Compiling ExN04SteppingAction.cc ...
Compiling ExN04SteppingVerbose.cc ...
Compiling ExN04TrackerHit.cc ...
Compiling ExN04TrackerParametrisation.cc ...
Compiling ExN04TrackerSD.cc ...
Compiling ExN04TrackingAction.cc ...
Creating shared library /home/mjmchugh/geant4_workdir/tmp/Linux-g++/exampleN04/libexampleN04.so ...
Compiling exampleN04.cc ...
In file included from /home/mjmchugh/Geant4/geant4.9.5.p01/source/interfaces/basic/include/G4UIExecutive.icc:38:0,
                 from /home/mjmchugh/Geant4/geant4.9.5.p01/source/interfaces/basic/include/G4UIExecutive.hh:80,
                 from exampleN04.cc:52:
/home/mjmchugh/Geant4/geant4.9.5.p01/source/interfaces/basic/include/G4UIQt.hh:40:21: fatal error: qobject.h: No such file or directory
compilation terminated.
make: *** [/home/mjmchugh/geant4_workdir/tmp/Linux-g++/exampleN04/exe/exampleN04.o] Error 1

After this I wanted to make sure I had the fatally missing object so I did:

mjmchugh:~$ locate qobject.h
/usr/include/qt4/Qt/qobject.h
/usr/include/qt4/QtCore/qobject.h

And clearly I have it in a sensible place but not where Geant is looking for it. I just upgraded to Ubuntu 12.10 and when I attempted to compile applications that had previously been working similar errors occurred.

Best,
Marty
Comment 1 Ben Morgan 2013-03-26 15:07:34 CET
Could you rebuild with

make CPPVERBOSE=1

and report the output here please? We need to see what include paths and links are being used.

Could you also confirm the location of the QtCore, QtGui and QtOpenGL libraries please?
Comment 2 Lin Tao 2013-04-02 13:14:57 CEST
My OS is Ubuntu. I try to fix the problem by setting the below environment variables.
 
export QTMOC="/usr/bin/moc-qt4"
export QTFLAGS="-I/usr/include/qt4 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL"
export QTLIBS="-L/usr/lib -lQtCore -lQtGui"
export GLQTLIBS="-L/usr/lib -lQtCore -lQtGui -lQtOpenGL"
Comment 3 Ben Morgan 2013-10-25 18:51:59 CEST
Release 10.0 will include a fix to export environment variables needed by Geant4Make to locate non-standard installs of Qt.

Note however that Geant4Make is deprecated.