Hi

I am new to using the openbabel API. I have an existing C++ program in
MSVC2008 that i would like to use some of the functions in openbabel.

I followed the instructions on the website and built the windows-vc2008 and
then tried to add the sample code:

#include <iostream>
#include <openbabel/obconversion.h>
using namespace std;

int main(int argc,char **argv)
{
  if(argc<3)
  {
    cout << "Usage: ProgrameName InputFileName OutputFileName";
    return 1;
  }

  ifstream ifs(argv[1]);
  if(!ifs)
  {
    cout << "Cannot open input file";
    return 1;
  }
  ofstream ofs(argv[2]);
  if(!ofs)
  {
    cout << "Cannot open output file";
    return 1;
  }
  OpenBabel::OBConversion conv(&ifs, &ofs);
  if(!conv.SetInAndOutFormats("CML","MOL"))
  {
    cout << "Formats not available" << "InputFileName";
    return 1;
  }
  int n = conv.Convert();
  cout << n << " molecules converted";

  return 0;
}

It finished compiling but i had the following linker issues:

1>obconversion.obj : error LNK2019: unresolved external symbol "public: int
__thiscall OpenBabel::OBFormat::RegisterFormat(char const *,char const *)"
(?RegisterFormat@OBFormat@OpenBabel@@QAEHPBD0@Z) referenced in function
"public: static int __cdecl OpenBabel::OBConversion::RegisterFormat(char
const *,class OpenBabel::OBFormat *,char const *)"
(?RegisterFormat@OBConversion@OpenBabel@@SAHPBDPAVOBFormat@2@0@Z)
1>obconversion.obj : error LNK2019: unresolved external symbol "public:
static class OpenBabel::OBPlugin * __cdecl
OpenBabel::OBPlugin::GetPlugin(char const *,char const *)"
(?GetPlugin@OBPlugin@OpenBabel@@SAPAV12@PBD0@Z) referenced in function
"protected: static int __cdecl
OpenBabel::OBConversion::LoadFormatFiles(void)"
(?LoadFormatFiles@OBConversion@OpenBabel@@KAHXZ)
...and more

I was wondering where are the libraries that i should be linking to? Are
they in the windows-vc2008 libs.

Thanks!

-- 
View this message in context: 
http://forums.openbabel.org/Problem-with-linking-tp3302682p3302682.html
Sent from the openbabel-devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to