user7356447
user7356447

Reputation: 43

Adding libxml to Eclipse project in Red Hat

I have a simple C++ project set up right now, where I'm trying to include libxml2. Im running Red Hat 7. I've read through various posts regarding adding external libraries to an Eclipse C project, see:

Most answers say to add a the library path to the GCC Linker or something along those lines. The problem is, I'm not entirely sure where my libxml2 is stored, though I am certain it's installed. None of my attempts so in adding the library path in the settings has worked. Here is my query to see where libxml2 is installed And here is me just looking through my whole file system to find libxml2. I'm still fairly new to Red Hat, so any help would be greatly appreciated. Thanks in advance!

Upvotes: 1

Views: 286

Answers (2)

nwellnhof
nwellnhof

Reputation: 33658

You're missing the libxml2.so symlink which is only installed with the libxml2-devel package. Since libxml2 is in a standard location, you don't have to pass additional paths to the linker. If you include any of the libxml2 headers, you will have to add /usr/include/libxml2 as custom include directory (option -I), though.

Upvotes: 1

HRgiger
HRgiger

Reputation: 2790

You can use

ldconfig -p

to find out library locations, i.e. myn looks like this (fedora):

$ldconfig -p | egrep -i libxml
    libxml2.so.2 (libc6,x86-64) => /lib64/libxml2.so.2
    libxml2.so (libc6,x86-64) => /lib64/libxml2.so
    libxmlsec1.so.1 (libc6,x86-64) => /lib64/libxmlsec1.so.1
    libxmlsec1-openssl.so.1 (libc6,x86-64) => /lib64/libxmlsec1-openssl.so.1
    libxmlsec1-openssl.so (libc6,x86-64) => /lib64/libxmlsec1-openssl.so
    libxmlsec1-nss.so.1 (libc6,x86-64) => /lib64/libxmlsec1-nss.so.1
    libxmlsec1-nss.so (libc6,x86-64) => /lib64/libxmlsec1-nss.so
    libxmlrpc_xmltok.so.3 (libc6,x86-64) => /lib64/libxmlrpc_xmltok.so.3
    libxmlrpc_xmlparse.so.3 (libc6,x86-64) => /lib64/libxmlrpc_xmlparse.so.3
    libxmlrpc_util.so.4 (libc6,x86-64) => /lib64/libxmlrpc_util.so.4
    libxmlrpc_server_cgi.so.3 (libc6,x86-64) => /lib64/libxmlrpc_server_cgi.so.3
    libxmlrpc_server_abyss.so.3 (libc6,x86-64) => /lib64/libxmlrpc_server_abyss.so.3
    libxmlrpc_server.so.3 (libc6,x86-64) => /lib64/libxmlrpc_server.so.3
    libxmlrpc_openssl.so.1 (libc6,x86-64) => /lib64/libxmlrpc_openssl.so.1
    libxmlrpc_client.so.3 (libc6,x86-64) => /lib64/libxmlrpc_client.so.3
    libxmlrpc_abyss.so.3 (libc6,x86-64) => /lib64/libxmlrpc_abyss.so.3
    libxmlrpc.so.3 (libc6,x86-64) => /lib64/libxmlrpc.so.3
    libxml++-2.6.so.2 (libc6,x86-64) => /lib64/libxml++-2.6.so.2

Here is whole steps how to add:

  1. Create new project using new c/c++ project

  2. Select c++ managed build

  3. Select hello world c++ project

  4. Enter project name

  5. Navigate to properties -> c/c++ build -> settings

  6. Select GCC C++ Compiler/Includes/Include Paths

  7. Add both path: /usr/include/libxml2/libxml and /usr/include/libxml2

  8. Select GCC C++ Linker/Libraries/Libraries

  9. Add xml2

  10. Apply and Close

  11. Re-Build project

Upvotes: 1

Related Questions