无法从 Eclipse 使用 libxml++

Cannot able to use libxml++ from eclipse

我需要将 libxml++ 添加到我的项目中。 libxmlpage说要用下面的方式编译代码。

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

我从终端试了一下,代码正在编译。但我想从 eclipse 构建代码。因此,我将 pkg-config --cflags --libs libxml++-2.6 添加到 project->properties->C/C++ build->settings->g++ compiler->miscellaneous->otherflags。添加后,当我尝试构建时出现错误。这是我的构建输出。 让所有

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

我做错了什么?请赐教。

对于使用 pkg-config 的库,我将此 Pkg-config 插件用于 eclipse:

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

Select每个项目你想要的包来自:

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

Select Pkg-config 选项卡。