Hi, On Mon, Jun 27, 2011 at 4:03 PM, Marianne <marianne.se...@epfl.ch> wrote: > Hello > > I am new to using the openbabel API and really exciting to use OB. I have an > existing C++ program in MSVC2008, I would like to use some of the functions > in Openbabel (Isomorphism). > > I followed the instructions on the website and built the windows-vc2008 and > then tried to add the sample code in C++ to make test of the results first: > > ------------------ > *#include <openbabel/obconversion.h> > #include <openbabel/mol.h> > > using namespace std; > using namespace OpenBabel; > > int _tmain(int argc,char **argv) { > // Read molecule from SMILES string > > OBConversion conv; > OBMol mol; > conv.SetInFormat("smi"); > conv.ReadString(&mol, "C(Cl)(=O)CCC(=O)Cl"); > > > > // Print out some general information > > conv.SetOutFormat("can"); > cout<<"Canonical SMILES: > "<<conv.WriteString(&mol)<<endl; > cout<<"The molecular weight is "<< > mol.GetMolWt(); > > > return 0; // exit with success > }</b> > --------------- > > Everything compile fine but when I execute the code, I obtain
I don't see anything wrong with the code but you could try to check the return values from some functions. OBConversion::SetInFormat, OBConversion::SetOutFormat and OBConversion::ReadString all return true on success. For example, if the format plugins are not found SetInFormat will return false. Tim > --------------- > *Canonical SMILES: > The molecular weight is 0* > > --------------- > > I link this small program with > 1) Include files: > openbabel-2.3.0\windows-vc2008\build\include > openbabel-2.3.0\windows-vc2008\include > openbabel-2.3.0\include > > 2) Source file: > openbabel-2.3.0\src > > 3) Lib file: > openbabel-2.3.0\windows-vc2008\build\src\Release\openbabel-2.lib > > > openbabel-2.dll is added in the exe folder. > > > Help will be really appreciate. Thank you > > > Marianne > > -- > View this message in context: > http://forums.openbabel.org/Help-everything-compile-well-But-no-results-tp3627796p3627796.html > Sent from the General discussion mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > OpenBabel-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss