Kumar
Kumar

Reputation: 636

Cannot able to use libxml++ from eclipse

I need to add libxml++ to my project. The libxml page says to use the following way to compile the code.

g++ program.cc -o program `pkg-config --cflags --libs libxml++-2.6`

I tried it from terminal and the code was compiling. But I would like to build the code from eclipse. Hence i added pkg-config --cflags --libs libxml++-2.6 to project->properties->C/C++ build->settings->g++ compiler->miscellaneous->otherflags. After adding, when i tried to build i am getting ERROR. Here is my build output. make all

Building file: ../src/main.cpp
Invoking: GCC C++ Compiler
g++ -E -O0 -g3 -Wall -c -fmessage-length=0 'pkg-config --cflags --libs libxml++-2.6' -MMD -MP -MF"src/main.d" -MT"src/main.d" -o "src/main.o" "../src/main.cpp"
g++: error: pkg-config --cflags --libs libxml++-2.6: No such file or directory
make: *** [src/main.o] Error 1

What am i doing wrong? Please enlighten me.

Upvotes: 1

Views: 143

Answers (1)

Galik
Galik

Reputation: 48645

For libraries that use pkg-config I use this Pkg-config plugin for eclipse:

https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt

Select the package you want for each project from:

Project -> Properties -> C/C++ Build -> Settings

Select the Pkg-config tab.

enter image description here

Upvotes: 1

Related Questions