Hi,
I have a problem with the installation of lammps.
During the process of the installation of the latest version of lammps, at least 3 of the following information are given:
…/fix_bond_break.h(72): warning #1125: function “LAMMPS_NS::Fix::rebuild_special()” is hidden by “LAMMPS_NS::FixBondBreak::rebuild_special” – virtual function override intended?
void rebuild_special(int);
^
mpicxx -g -O3 -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -c …/fix_bond_create.cpp
…/fix_bond_create.h(81): warning #1125: function “LAMMPS_NS::Fix::rebuild_special()” is hidden by “LAMMPS_NS::FixBondCreate::rebuild_special” – virtual function override intended?
void rebuild_special(int);
^
Does this matter or not ? Is there any solution to fix it ? Thanks in advance!
Best,
Yongbiao
It is just a compiler warning telling you that a parent class function, which has the same name as a derived class function, is not virtual. I believe it overrides it anyway due to name hiding.
Ray
Hi,
I have a problem with the installation of lammps.
During the process of the installation of the latest version of lammps,
at least 3 of the following information are given:
../fix_bond_break.h(72): warning #1125: function
"LAMMPS_NS::Fix::rebuild_special()" is hidden by
"LAMMPS_NS::FixBondBreak::rebuild_special" -- virtual function override
intended?
void rebuild_special(int);
^
mpicxx -g -O3 -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1
-c ../fix_bond_create.cpp
../fix_bond_create.h(81): warning #1125: function
"LAMMPS_NS::Fix::rebuild_special()" is hidden by
"LAMMPS_NS::FixBondCreate::rebuild_special" -- virtual function override
intended?
void rebuild_special(int);
^
Does this matter or not ? Is there any solution to fix it ? Thanks in
advance!
not sure whether it matters, but it is definitely a bug and needs to be
looked into.
axel.
It is just a compiler warning telling you that a parent class function,
which has the same name as a derived class function, is not virtual. I
believe it overrides it anyway due to name hiding.
sorry, but no. it means that a function declared virtual in the base class
has a different signature in the derived class. that is almost always
either bad code design or a bug. thus it either means that the function
name in the derived class needs to be changed (as it has a different
purpose) or its number and type of arguments (so that it matches the
signature of the base class).
axel.
Fix.h should have this line:
virtual void rebuild_special(int) {}
instead of
virtual void rebuild_special() {}
Will be in next patch.
Thanks,
Steve
Fix.h should have this line:
virtual void rebuild_special(int) {}
instead of
virtual void rebuild_special() {}
Will be in next patch.
that won't fix the issue. check out the last 3 lines below.
[[email protected] src]$ grep rebuild_special *.cpp
fix_bond_break.cpp: // b/c in rebuild_special() neighs of all 1-2s are
added,
fix_bond_break.cpp: if (influenced) rebuild_special(i);
fix_bond_break.cpp:void FixBondBreak::rebuild_special(int m)
fix_bond_create.cpp: // b/c in rebuild_special() neighs of all 1-2s are
added,
fix_bond_create.cpp: // prevents list from overflowing, will be rebuilt
in rebuild_special()
fix_bond_create.cpp: // rebuild_special first, since used by
create_angles, etc
fix_bond_create.cpp: rebuild_special(i);
fix_bond_create.cpp:void FixBondCreate::rebuild_special(int m)
fix_drude.cpp: if (!rebuildflag) rebuild_special();
fix_drude.cpp:void FixDrude::rebuild_special(){
special.cpp: modify->fix[ifix]->rebuild_special();
ah, I see the problem now - should be fixed in next patch,
be renaming a couple of the functions.
Steve