g++ can't find "openbabel/obconversion.h"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

g++ can't find "openbabel/obconversion.h"

James Johnson
Hello all,

I'm trying to compile a c++ program that uses the openbabel api, however g++ doesn't recognize where the openbabel library is.

I installed openbabel on ubuntu using: sudo apt-get install openbabel

I get the error: fatal error: openbabel/obconversion.h: No such file or directory

Any help is much appreciated,

Thank you!

- James

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

_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: g++ can't find "openbabel/obconversion.h"

David Hall
You need libopenbabel-dev



On Nov 20, 2016, at 6:50 PM, James Johnson <[hidden email]> wrote:

I installed openbabel on ubuntu using: sudo apt-get install openbabel



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

_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: g++ can't find "openbabel/obconversion.h"

Geoff Hutchison
In reply to this post by James Johnson
> I installed openbabel on ubuntu using: sudo apt-get install openbabel
> I get the error: fatal error: openbabel/obconversion.h: No such file or directory


Most Linux distributions do not install the headers or other development interfaces in the standard packages. You'll want to install openbabel-devel (or similar name)

Hope that helps,
-Geoff
------------------------------------------------------------------------------
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: g++ can't find "openbabel/obconversion.h"

Geoff Hutchison
I'd keep this on the list, because there are plenty of other people who can answer your problem.

You're not linking to libopenbabel:
g++ Process_Ligand.cpp 
/tmp/cceu81Mg.o: In function `Convert_2_MOL2(char*, char const*, char const*, char*, int, int)':
Process_Ligand.cpp:(.text+0x1a70): undefined reference to `OpenBabel::OBConversion::OBConversion(std::istream*, std::ostream*)'

You need to have a -L/path/to/library and -lopenbabel on the command-line.

This isn't really an Open Babel thing, this is a question about how to compile and link C++ programs on UNIX/Linux.

-Geoff


On Nov 20, 2016, at 10:16 PM, James Johnson <[hidden email]> wrote:

Thank you for the responses.

I installed libopenbabel-dev with no avail. I looked at the folder location and it was /usr/include/openbabel2.0/openbabel. I reasoned that the extra openbabel2.0 was causing the problem so i moved the openbabel folder directly to /usr/include.

This fixed the problem of it not recognizing the file, however now there is the problem of a bunch of undefined references.

Thanks again for your help!

- James

On Sun, Nov 20, 2016 at 4:26 PM, Geoffrey Hutchison <[hidden email]> wrote:
> I installed openbabel on ubuntu using: sudo apt-get install openbabel
> I get the error: fatal error: openbabel/obconversion.h: No such file or directory


Most Linux distributions do not install the headers or other development interfaces in the standard packages. You'll want to install openbabel-devel (or similar name)

Hope that helps,
-Geoff



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

_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: g++ can't find "openbabel/obconversion.h"

Dimitri Maziuk
On 11/21/2016 02:29 PM, Geoffrey Hutchison wrote:
> I'd keep this on the list, because there are plenty of other people who can answer your problem.
>
> You're not linking to libopenbabel:
>> g++ Process_Ligand.cpp
>> /tmp/cceu81Mg.o: In function `Convert_2_MOL2(char*, char const*, char const*, char*, int, int)':
>> Process_Ligand.cpp:(.text+0x1a70): undefined reference to `OpenBabel::OBConversion::OBConversion(std::istream*, std::ostream*)'
>
> You need to have a -L/path/to/library and -lopenbabel on the command-line.

Actually, some of them don't ship .a libs in -devel packages anymore so
you can have all the right paths and it'll still fail. See if you have
"-static" in your build options.

Longer explanation: you can link your code to dynamic libraries (.so) or
create a self-contained "static" executable. The latter requires a
"static" library that some linux distribution vendors and/or package
maintainers no longer provide.

--
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu


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

_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

signature.asc (197 bytes) Download Attachment