Project

General

Profile

Support #16100

Support #16096: Fix problems found when attempting to build with gcc 6.3.0

problem compiling lardataobj/MCBase/MCWire.h with gcc 6.3.0

Added by Lynn Garren over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
04/05/2017
Due date:
% Done:

100%

Estimated time:
Spent time:
Experiment:
LArSoft
Co-Assignees:
Duration:

Description

This code block fails:

// Define a pointer comparison
namespace std {
  template <>
  class less<sim::MCWire*>
  {
  public:
    bool operator()( const sim::MCWire* lhs, const sim::MCWire* rhs )
    { return (*lhs) < (*rhs); }
  };
}

The error message:

[ 54%] Building CXX object lardataobj/lardataobj/MCBase/CMakeFiles/lardataobj_MCBase.dir/MCWire.cxx.
o
In file included from /home/garren/scratch/larsoft/dev/srcs/lardataobj/lardataobj/MCBase/MCWire.cxx:
4:0:
/home/garren/scratch/larsoft/dev/srcs/lardataobj/lardataobj/MCBase/MCWire.h:68:9: error: ‘less’ is n
ot a class template
   class less<sim::MCWire*>
         ^~~~
/home/garren/scratch/larsoft/dev/srcs/lardataobj/lardataobj/MCBase/MCWire.h:69:3: error: explicit sp
ecialization of non-template ‘std::less’
   {
   ^

The solution is not obvious.

History

#2 Updated by Lynn Garren over 3 years ago

  • Assignee changed from Gianluca Petrillo to Lynn Garren
  • % Done changed from 0 to 100

The problem was simply a missing header. std::less is defined in the "functional" header.

#3 Updated by Lynn Garren over 3 years ago

  • Status changed from Assigned to Resolved

#4 Updated by Lynn Garren over 3 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF