Bugs item #3565287, was opened at 2012-09-06 07:35
Message generated for change (Tracker Item Submitted) made by baoilleach
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=428740&aid=3565287&group_id=40728

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library Functions
Group: 2.3.x
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Noel O'Boyle (baoilleach)
Assigned to: Nobody/Anonymous (nobody)
Summary: Use of OBPairTemplate causes linking error

Initial Comment:
I don't seem to be able to use OBPairTemplate or its typedef (OBPairInteger), 
from within OB. It causes a linking problem:

For example, adding the following to MDLFormat.cpp gives:

    // Store the Chiral Flag
    unsigned int chiralFlagVal = ReadUIntField((line.substr(12, 3)).c_str());
    OBPairInteger *chiralFlag = new OBPairInteger();
    chiralFlag->SetAttribute("MOL Chiral Flag");
    chiralFlag->SetValue(chiralFlagVal); // 1 ("Absolute Chirality"), 0 
("Relative Chirality")
    mol.SetData(chiralFlag);

1>mdlformat.obj : error LNK2019: unresolved external symbol 
"__declspec(dllimport) public: void __thiscall 
OpenBabel::OBPairTemplate<int>::SetValue(int)" 
(__imp_?SetValue@?$OBPairTemplate@H@OpenBabel@@QAEXH@Z) referenced in function 
"public: virtual bool __thiscall OpenBabel::MDLFormat::ReadMolecule(class 
OpenBabel::OBBase *,class OpenBabel::OBConversion *)" 
(?ReadMolecule@MDLFormat@OpenBabel@@UAE_NPAVOBBase@2@PAVOBConversion@2@@Z)
1>mdlformat.obj : error LNK2019: unresolved external symbol 
"__declspec(dllimport) public: __thiscall 
OpenBabel::OBPairTemplate<int>::OBPairTemplate<int>(void)" 
(__imp_??0?$OBPairTemplate@H@OpenBabel@@QAE@XZ) referenced in function "public: 
virtual bool __thiscall OpenBabel::MDLFormat::ReadMolecule(class 
OpenBabel::OBBase *,class OpenBabel::OBConversion *)" 
(?ReadMolecule@MDLFormat@OpenBabel@@UAE_NPAVOBBase@2@PAVOBConversion@2@@Z)
1>mdlformat.obj : error LNK2001: unresolved external symbol "public: virtual 
int const & __thiscall 
OpenBabel::OBPairTemplate<int>::GetGenericValue(void)const " 
(?GetGenericValue@?$OBPairTemplate@H@OpenBabel@@UBEABHXZ)
1>mdlformat.obj : error LNK2019: unresolved external symbol 
"__declspec(dllimport) public: virtual __thiscall 
OpenBabel::OBPairTemplate<int>::~OBPairTemplate<int>(void)" 
(__imp_??1?$OBPairTemplate@H@OpenBabel@@UAE@XZ) referenced in function "public: 
virtual void * __thiscall OpenBabel::OBPairTemplate<int>::`scalar deleting 
destructor'(unsigned int)" (??_G?$OBPairTemplate@H@OpenBabel@@UAEPAXI@Z)
1>C:\Tools\openbabel\current\windows-vc2008\build\bin\Debug\formats_common.obf 
: fatal error LNK1120: 4 unresolved externals

However, using OBPairData instead is fine:
    // Store the Chiral Flag
    unsigned int chiralFlagVal = ReadUIntField((line.substr(12, 3)).c_str());
    OBPairData *chiralFlag = new OBPairData();
    chiralFlag->SetAttribute("MOL Chiral Flag");
    chiralFlag->SetValue("1"); // 1 ("Absolute Chirality"), 0 ("Relative 
Chirality")
    mol.SetData(chiralFlag);

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=428740&aid=3565287&group_id=40728

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to