c++ - 无法从 Eclipse 使用 libxml++

标签 c++ eclipse g++ libxml2

我需要将 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 选项卡。

enter image description here

关于c++ - 无法从 Eclipse 使用 libxml++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31890440/

相关文章:

java - 程序为 println(String s) 提供正确的输出;但不是 print(String s);为什么?

Qt编译错误位/c++config.h未找到

c++ - 为什么我需要在 g++ 中使用 typedef typename 而不是 VS?

c++ - 指向类成员作为模板参数的指针(具有以下类的类型)

c++ - 指定的内存位置中没有指针。删除操作有什么问题?

c++ - 调用Referenced Vector的成员函数(size)抛出错误

c++ - Mingw32 是否支持 std::thread?

c++ - 继承类型强制

java - 查找 EJB 组件的正确方法是什么?

Eclipse 第谷 : Compile error when using the java. xml.bind 模块?