In ScanImage.cc I call virtual constructor for my class GaugeC
IStreamC is(*curGauge);
if(!is)
throw ExceptionOperationFailedC("Failed to open gauge file.");
GaugeC gauge(is);
it should construct LinearGaugeC class, but it gives
WARNING: Failed to find virtual constructor for type 'LinearGaugeBodyC'
in runtime.
The strange thing is: when I comment PLIB line in def.mk everything start working properly, i.e. virtual constructor become able to find the virtual constructor. It seems that when qm creates the library it does not put LinGauge.cc there. (There are two things which suggest to it. First, LinGauge.cc is not present in list of sources in ddd debugger. Second, LinearGaugeBodyC is not in the virtual constructor's classes table.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is the kind of problem the MUSTLINK file is used to solve. If the code isn't used directly the linker won't link it into the executable. So you need to explicit say you need it somewhere. There are pleny examples of the use of MUSTLINK in RAVL, particularly in the ImageIO stuff. If you need more help let me know.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have the following def.mk project file
MAINS=createGauge.cc ScanImage.cc
SOURCES=ImageScanner.cc Gauge.cc LinGauge.cc PreprocFunc.cc CommonPreproc.cc
HEADERS=Gauge.hh LinGauge.hh ImageScanner.hh PreprocFunc.hh CommonPreproc.hh
PLIB=RavlObjDet
USESLIBS=RavlImageIO RavlIO RavlCore RavlPatternRec RavlSVM
In ScanImage.cc I call virtual constructor for my class GaugeC
IStreamC is(*curGauge);
if(!is)
throw ExceptionOperationFailedC("Failed to open gauge file.");
GaugeC gauge(is);
it should construct LinearGaugeC class, but it gives
WARNING: Failed to find virtual constructor for type 'LinearGaugeBodyC'
in runtime.
The strange thing is: when I comment PLIB line in def.mk everything start working properly, i.e. virtual constructor become able to find the virtual constructor. It seems that when qm creates the library it does not put LinGauge.cc there. (There are two things which suggest to it. First, LinGauge.cc is not present in list of sources in ddd debugger. Second, LinearGaugeBodyC is not in the virtual constructor's classes table.)
This is the kind of problem the MUSTLINK file is used to solve. If the code isn't used directly the linker won't link it into the executable. So you need to explicit say you need it somewhere. There are pleny examples of the use of MUSTLINK in RAVL, particularly in the ImageIO stuff. If you need more help let me know.
It is interesting to know what MUSTLINK actually does.