GALPROP
https://galprop.stanford.edu/forum/

Compiling problems
https://galprop.stanford.edu/forum/viewtopic.php?f=6&t=222
Page 2 of 2

Author:  gudlaugu [ Wed Oct 07, 2015 2:55 am ]
Post subject:  Re: Compiling problems

ellis.owen2 wrote:
Example error message:

Code:
RadiationField.cc: In member function ‘void rf::RadiationField::ClearData()’:
RadiationField.cc:827:50: error: request for member ‘size’ in ‘((rf::RadiationField*)this)->rf::RadiationField::fPositionData’, which is of non-class type ‘int’
       for (unsigned int i = 0; i < fPositionData.size(); ++i) {
                                                  ^
RadiationField.cc:829:17: error: invalid types ‘int[unsigned int]’ for array subscript
  fPositionData[i].clear();
                 ^
RadiationField.cc:830:14: error: invalid types ‘int[unsigned int]’ for array subscript
  fRangeData[i].clear();
              ^



If you look at the RadiationField.h file you see that fPositionData is a vector container. The error indicates that for some reason the compiler isn't finding the std library headers and vector isn't defined in which case it assigns the default type of int to the variable. There should be an error further up in the log that gives you a clue. You should always investigate compile errors in order of appearance, because later errors might be a consequence of the first.

Author:  strong [ Wed Oct 07, 2015 3:25 am ]
Post subject:  Re: Compiling problems

it would probably need
using namespace std;
before
#include<vector>
even though std is explicit in the definition.
This requirement could be compiler-dependent.

This done in other cases using std, e.g. Galprop.h

Author:  gudlaugu [ Wed Oct 07, 2015 4:50 am ]
Post subject:  Re: Compiling problems

strong wrote:
gcc includes g++ in fact

Yes, the gcc distribution includes g++, but the gcc program is still only a c compiler and should not be used for c++ code.

strong wrote:
it would probably need
using namespace std;
before
#include<vector>
even though std is explicit in the definition.

This is simply incorrect. The variable declaration explicitly states the namespace which is enough.

Author:  strong [ Wed Oct 07, 2015 5:01 am ]
Post subject:  Re: Compiling problems

as long as the namespace has been made available with 'using', maybe this is not automatic on some systems or requires some compiler option. anyway worth a try perhaps.

Author:  ellis.owen2 [ Wed Oct 07, 2015 6:04 am ]
Post subject:  Re: Compiling problems

Putting
Code:
using namespace std;
before
Code:
#include<vector>
didn't make any difference unfortunately.

It looks like the first error message I get is:
Code:
 #define VERSION "2.1.2.3"
 ^
In file included from RadiationField.cc:10:0:
./RadiationField.h:30:13: error: ‘Hep3Vector’ does not name a type
     typedef Hep3Vector ThreeVector;
             ^


I think this is to do with CLHEP? Perhaps the problem is there?

I've attached the full error message as I can't make much sense of it...

Attachments:
galprop_error_message.txt [27.1 KiB]
Downloaded 340 times

Author:  gudlaugu [ Wed Oct 07, 2015 7:04 am ]
Post subject:  Re: Compiling problems

There seems to be something wrong with the detection of the CLHEP version or a mismatch between the detected and used version. A brute force solution would be to change
Code:
#ifdef CLHEP_V1_8
    typedef Hep3Vector ThreeVector;
#else
    typedef CLHEP::Hep3Vector ThreeVector;
#endif

to
Code:
    typedef CLHEP::Hep3Vector ThreeVector;

in RadiationField.h. Alternatively you should make sure you are configuring galprop with the same clhep instance you used for compilation. In compilation you are picking up the headers from the version installed in /usr.

Author:  ellis.owen2 [ Wed Oct 07, 2015 9:03 am ]
Post subject:  Re: Compiling problems

Thanks - that fix worked & it now appears to have compiled & installed successfully with Ubuntu. I found with the Red Hat system, I didn't need to make the last fix.

Thank you both very much for your help.

Ellis

Page 2 of 2 All times are UTC - 8 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/