Message: Compilation Problem - Using "Phase Space" File as Input For Simulation Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Compilation Problem - Using "Phase Space" File as Input For Simulation 

Forum: Installation and Configuration
Date: 27 Jan, 2012
From: Ben Hug <Ben Hug>

Hi All,

Im having a few issues getting my code to compile.

I am trying to read in a binary file and then use the information from this binary file as the source for my G4 application. The code below if from my PrimaryGeneratorAction.cc file

I have included the following: #include <iostream> using namespace std;

### FOLLOWING IS IN CONSTRUCTOR### std::ifstream ifs; ifs.open("My_File.binary"); if(ifs.is_open()){G4cout<<######<<G4endl;} else {G4cout<<####<<G4endl;}

###FOLLOWING IS IN DESTRUCTOR#### ifs.close();

## FOLLOWING IS IN GENERATE PRIMARIES#### G4float all_data[8]; ifs.read((char*)&all_data,size of all_data); DEFINE DATA HERE...

The compilation errors which keep popping up refer to the the lines #ifs.close() and ifs.read..... The error which is produced when compiling is error: ifs was not declared in this scope. If I comment out these line in the destructor the code compiles.

I have done a little bit of reading and I am compiling using gcc. forums suggest that using g++ can solve this issue but as far as Im aware I thought that G4 required Gcc...

Has anyone got any suggestions??

Thanks in advance,

Ben

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Note: Re: Compilation Problem - Using   (Ben Morgan - 30 Jan, 2012)
 Add Message Add Message
to: "Compilation Problem - Using "Phase Space" File as Input For Simulation"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]