On 2013-02-12 07:54, Peter wrote:
> Hi,
>
> I am new to openbabel and am trying to write short C++ applications using
> openbabel. The openbabel installation went on fine.
> Now I am trying to test a short code:
> e.g.
> #include <iostream>
> #include <openbabel/mol.h>
> #include <openbabel/obconversion.h>
> using namespace std;
>
> int main(int argc,char **argv){
>    OBConversion conv(&cin,&cout);
>    if(conv.SetInAndOutFormats("SDF","MOL2")){
>      OBMol mol;
>      if(conv.Read(&mol))
>        conv->Write(&mol);
>    }
>    return(1);
> }
>
> Compiling this using : g++ -L/usr/local/lib -l openbabel -I
> /usr/local/include/openbabel-2.0 main.cpp -o test.o
> would raise errors, as:
> main.cpp:7: error: ‘OBConversion’ was not declared in this scope
> main.cpp:7: error: expected ‘;’ before ‘conv’
> main.cpp:8: error: ‘conv’ was not declared in this scope
> main.cpp:9: error: ‘OBMol’ was not declared in this scope
>
>
> When I change it to:
> OpenBabel::OBConversion conv(&cin,&cout);
> OpenBabel::OBMol mol;
> The error
> main.cpp:11: error: base operand of ‘->’ has non-pointer type
> ‘OpenBabel::OBConversion’
>
You need to replace it by a .

>
> Any help/suggestion is appreciated.
>
> Thanks,
> Peter
>
>
>
>
> --
> View this message in context: 
> http://forums.openbabel.org/Cannot-create-objects-using-C-API-tp4655946.html
> Sent from the General discussion mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013
> and get the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>


-- 
David van der Spoel, Ph.D., Professor of Biology
Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:  +46184714205.
sp...@xray.bmc.uu.se    http://folding.bmc.uu.se

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to