我需要将 libxml++ 添加到我的项目中。 libxml page说要用下面的方式来编译代码。
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
的库,我为 eclipse
使用了这个 Pkg-config
插件:
https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt
为每个项目选择您想要的包:
项目 -> 属性 -> C/C++ 构建 -> 设置
选择 Pkg-config
选项卡。
关于c++ - 无法从 Eclipse 使用 libxml++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31890440/