Problem 318

Summary: "parse errors" and "syntax errors" when compiling
Product: Geant4 Reporter: schiefer
Component: globalAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P2    
Version: 3.2   
Hardware: PC   
OS: Linux   

Description schiefer 2001-11-10 06:22:55 CET
When I run Configure -install and set all necesary parameters appropriatly, I
get several compile time errors, starting at G4PhysicsFreeVeector.cc:

Compiling G4PhysicsFreeVector.cc ...
In file included from include/G4PhysicsFreeVector.hh:59,
                 from src/G4PhysicsFreeVector.cc:44:
include/G4DataVector.hh: In method `G4DataVector::G4DataVector ()':
include/G4DataVector.hh:81: parse error before `::'
include/G4DataVector.hh: In method `G4DataVector::G4DataVector
(unsigned int)':
include/G4DataVector.hh:87: parse error before `::'
include/G4DataVector.hh: In method `G4DataVector::G4DataVector
(unsigned int, double)':
include/G4DataVector.hh:93: parse error before `::'
In file included from src/G4PhysicsFreeVector.cc:44:
include/G4PhysicsFreeVector.hh: In method `size_t
G4DataVector::removeAll (const G4double &)':
include/G4PhysicsFreeVector.hh:95: cannot declare member function
`G4DataVector::removeAll (const G4double
&)::G4PhysicsFreeVector::FindBinLocation' within `G4DataVector'
include/G4PhysicsFreeVector.hh:95: syntax error before `{'
include/G4PhysicsFreeVector.hh:107: `numberOfBin' undeclared (first use
this function)
include/G4PhysicsFreeVector.hh:107: (Each undeclared identifier is
reported only once for each function it appears in.)
include/G4PhysicsFreeVector.hh:107: Internal error: Segmentation fault.
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
gmake[2]: ***
[/software/schiefer/geant4.3.2/tmp/Linux-g++/G4globman/G4PhysicsFreeVector.o]
Error 1

I cannot figure out what casues the problem and if I somwhow configured wrongly
or if it indeed is a bug.

I am using RedHat Linux 7.0, g++ 2.96

Thank you for your support,

Philipp Schieferdecker
ATLAS Experiment
LMU Munich
Comment 1 Gabriele Cosmo 2001-11-10 11:02:59 CET
Geant4 3.2 is not supported on gcc-2.96.XX.
Moreover, it is known that Red-Hat 7.0 is shipped with a flawed and
unofficial version of the gcc compiler, -never- released by GNU.
This compiler may require strict ISO/ANSI setup; if so, the following
may help, although we cannot guarantee...
In geant4/config/sys/Linux-g++.gmk modify the line:

  CXXFLAGS  := -pipe -fno-for-scope -DGNU_GCC

to

  CXXFLAGS  := -ansi -pedantic -pipe -fno-for-scope -DGNU_GCC

And the following lines:

  ifdef G4USE_OSPACE
    CPPFLAGS += -DOS_LINUX_2 -DOS_NEW_CHECK -DOS_STL_ASSERT
    CPPFLAGS += -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
    CPPFLAGS += -I$(OSPACE_BASE_DIR)/ospace/std -I$(OSPACE_BASE_DIR)
#  else
#    G4USE_STD_NAMESPACE := yes
#    CPPFLAGS += -DG4USE_STD_NAMESPACE
  endif

to:

  G4USE_STD_NAMESPACE := yes
  CPPFLAGS += -DG4USE_STD_NAMESPACE

Rebuild from scratch:

  cd geant4/source
  gmake clean
  gmake

Regards.
Comment 2 schiefer 2001-11-11 13:34:59 CET
Thanks, I installed gcc 2.95.3 and it seems to work fine.