I am trying to modify a working G4 example in order to import the geometry from a STEP compliant CAD file. The following warnings are received when I include the file G4AssembyCreator.hh in the geometry.cc file at src/ directory : /home/jmperez/GEANT4/geant4.3.1/source/geometry/solids/STEP/include/SdaiCONFIG_CONTROL_DESIGN.h:21568:5: warning: pasting "SDAI" and "::" does not give a valid preprocessing token /home/jmperez/GEANT4/geant4.3.1/source/geometry/solids/STEP/include/SdaiCONFIG_CONTROL_DESIGN.h:21570:5: warning: pasting "::" and "DAObject__set_var" does not give a valid preprocessing token In file included from /home/jmperez/GEANT4/geant4.3.1/source/geometry/solids/STEPinterface/include/G4GeometryCreator.hh:27, from /home/jmperez/GEANT4/geant4.3.1/source/geometry/solids/STEPinterface/include/G4AssemblyCreator.hh:29, from src/geometria.cc:21: /home/jmperez/GEANT4/geant4.3.1/source/geometry/solids/STEP/include/schema.h:46:1: warning: pasting "::" and "Model_contents_ptr" does not give a valid preprocessing token /home/jmperez/GEANT4/geant4.3.1/source/geometry/solids/STEP/include/schema.h:46:1: warning: pasting "SDAI" and "::" does not give a valid preprocessing token Creating/replacing object files in ./tmp/Linux-g++/main/libmain.a Using global libraries. The next linking error is received when the line G4AssemblyCreator MyAC("nachito.step"); is included in the Geometry.cc file at src/ directory: Linking main ... /home/jmperez/GEANT4/geant4.3.1/lib/Linux-g++/libG4geometry.a(G4GeometryTable.o)(.bss+0xc0): multiple definition of `dir' ./tmp/Linux-g++/main/libmain.a(generador.o)(.bss+0x98): first defined here /usr/bin/ld: Warning: size of symbol `dir' changed from 24 to 8 in G4GeometryTable.o collect2: ld returned 1 exit status gmake: *** [bin/Linux-g++/main] Error 1 Question: Could you provide a working example using these classes?
From the errors layout it looks like the user is compiling using a g++ compiler version not supported for release 3.1. The supported compiler for Geant4 3.1 is egcs-1.1.2. The user should upgrade to release 4.0 (and related patches) to build successfully on gcc-2.95.2 or higher. The relevant part of an example on how to import a STEP AP203 file from a CAD system is given in the User Manual for Application Developers. A real example will be anyhow provided in future. On Linux, to avoid incompatibilities with ANSI standard treatment of strings, the code must be compiled in non-ANSI mode. Therefore, I would suggest if the following lines are added to the GNUmakefile (or in the build setup) of the user application using the STEP-reader libraries: ifneq(,$(findstring Linux-g++,$(G4SYSTEM))) ansi_options = -Wall -ansi -pedantic NCXX = $(filter-out $(ansi_options),$(CXXFLAGS)) NCPP = $(CPPFLAGS) CXXFLAGS := $(NCXX) CPPFLAGS := $(NCPP) -w endif