It is currently Thu Jun 12, 2025 4:14 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Compiling problems
PostPosted: Wed Oct 07, 2015 2:55 am 
Offline
Site Admin

Joined: Fri Jul 18, 2008 3:04 pm
Posts: 61
Location: Stanford
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.

_________________
Gudlaugur Johannesson, GALPROP developer


Top
 Profile  
 
 Post subject: Re: Compiling problems
PostPosted: Wed Oct 07, 2015 3:25 am 
Offline

Joined: Wed May 17, 2006 7:02 am
Posts: 285
Location: MPE Garching
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

_________________
Andy Strong, MPE


Top
 Profile  
 
 Post subject: Re: Compiling problems
PostPosted: Wed Oct 07, 2015 4:50 am 
Offline
Site Admin

Joined: Fri Jul 18, 2008 3:04 pm
Posts: 61
Location: Stanford
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.

_________________
Gudlaugur Johannesson, GALPROP developer


Top
 Profile  
 
 Post subject: Re: Compiling problems
PostPosted: Wed Oct 07, 2015 5:01 am 
Offline

Joined: Wed May 17, 2006 7:02 am
Posts: 285
Location: MPE Garching
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.

_________________
Andy Strong, MPE


Top
 Profile  
 
 Post subject: Re: Compiling problems
PostPosted: Wed Oct 07, 2015 6:04 am 
Offline

Joined: Mon Aug 10, 2015 10:26 am
Posts: 11
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 1076 times
Top
 Profile  
 
 Post subject: Re: Compiling problems
PostPosted: Wed Oct 07, 2015 7:04 am 
Offline
Site Admin

Joined: Fri Jul 18, 2008 3:04 pm
Posts: 61
Location: Stanford
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.

_________________
Gudlaugur Johannesson, GALPROP developer


Top
 Profile  
 
 Post subject: Re: Compiling problems
PostPosted: Wed Oct 07, 2015 9:03 am 
Offline

Joined: Mon Aug 10, 2015 10:26 am
Posts: 11
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group