Menu

Virtual construction failure

2003-08-03
2003-08-04
  • Alexey Kostin

    Alexey Kostin - 2003-08-03

    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.)

     
    • Charles Galambos

      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.

       
    • Alexey Kostin

      Alexey Kostin - 2003-08-04

      It is interesting to know what MUSTLINK actually does.

       

Log in to post a comment.