Opened 8 years ago

Last modified 8 years ago

#26 new defect

Error compiling Mars with gcc 5.3

Reported by: mnoethe Owned by: somebody
Priority: major Milestone: milestone:
Component: component1 Version:
Keywords: Mars Cc:

Description

Trying to compile Mars on Ubuntu 16.04 with gcc 5.3 I get the following error:

MTime.cc: In member function 'virtual Bool_t MTime::AsciiWrite(std::ostream&) const':
MTime.cc:1154:12: error: cannot convert 'std::ostream {aka std::basic_ostream<char>}' to 'Bool_t {aka bool}' in return
     return out;
            ^

Change History (9)

comment:1 by tbretz, 8 years ago

It should be well defined:
http://www.cplusplus.com/reference/ios/ios/operator_bool/

Maybe an explicit cast would help? "return (bool)out;"

comment:2 by mnoethe, 8 years ago

This seems to work, but there some more places where the explicit cast is necessary. For example in mfileio/MReadFiles.cc:154 .

After I fixed this, I get the following error now:

In file included from FileIOCint.h:44:0,
                 from FileIOCint.cc:17:
MWriteFitsFile.h: In function 'int G__FileIOCint_703_0_36(G__value*, const char*, G__param*, int)':
MWriteFitsFile.h:273:13: error: 'std::__cxx11::string MWriteFitsFile::GetFitsString(const _T&) [with _T = double; std::__cxx11::string = std::__cxx11::basic_string<char>]' is private
 std::string MWriteFitsFile::GetFitsString(const double& value);
             ^
FileIOCint.cc:4157:119: error: within this context
          string xobj = ((MWriteFitsFile*) G__getstructoffset())->GetFitsString(*(double*) G__Doubleref(&libp->para[0]));
                                                                                                                       ^
In file included from FileIOCint.h:44:0,
                 from FileIOCint.cc:17:
MWriteFitsFile.h: In function 'int G__FileIOCint_703_0_37(G__value*, const char*, G__param*, int)':
MWriteFitsFile.h:275:13: error: 'std::__cxx11::string MWriteFitsFile::GetFitsString(const _T&) [with _T = float; std::__cxx11::string = std::__cxx11::basic_string<char>]' is private
 std::string MWriteFitsFile::GetFitsString(const float& value);
             ^
FileIOCint.cc:4170:117: error: within this context
          string xobj = ((MWriteFitsFile*) G__getstructoffset())->GetFitsString(*(float*) G__Floatref(&libp->para[0]));
                                                               
Last edited 8 years ago by mnoethe (previous) (diff)

comment:3 by tbretz, 8 years ago

For me it looks like that rootcint assumes that the function is public because it is defined outside of the class. I am not sure if specialization can be defined inside the class as well. This might be the best choice. Otherwise, one could try to encapsulate the specialization in an
#ifndef CINT
#endif

Version 0, edited 8 years ago by tbretz (next)

comment:4 by mnoethe, 8 years ago

Also, there seems to be a typo in the first two lines:

#ifndef MARS_MWreitFitsFile
#define MARS_MWreitFitsFile

comment:5 by tbretz, 8 years ago

It is not important, but might be nice to be fixed.

comment:6 by mnoethe, 8 years ago

I also get a warning for this suspicious line:

MRawRunHeader.cc: In member function 'Bool_t MRawRunHeader::FixAssignment()':
MRawRunHeader.cc:548:26: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
     if (!fTelescopeNumber==1)

Is this intentional or are there some missing parenthese?

comment:7 by mnoethe, 8 years ago

Does MWriteFitsFile::GetFitsString have to be private? I have a solution that works if it would be public.

If I apply this, MCint.h is exploding because struct zofits::CompressedColumn is protected.

in reply to:  6 comment:8 by tbretz, 8 years ago

Replying to mnoethe:

I also get a warning for this suspicious line:

MRawRunHeader.cc: In member function 'Bool_t MRawRunHeader::FixAssignment()':
MRawRunHeader.cc:548:26: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
     if (!fTelescopeNumber==1)

Is this intentional or are there some missing parenthese?

It should be A!=B. Maybe the !A==B is for historical reasons.

in reply to:  7 comment:9 by tbretz, 8 years ago

Replying to mnoethe:

Does MWriteFitsFile::GetFitsString have to be private? I have a solution that works if it would be public.

If I apply this, MCint.h is exploding because struct zofits::CompressedColumn is protected.

Well... it is certainly nothing which makes sense if it is public... I would be more interested in the fact why it works with gcc 4.8.4. This might give us a hint of what the real problem is.

Note: See TracTickets for help on using tickets.