[libxml2] Édition des liens difficile avec Eclipse
Bonjour à tous,
Après avoir lu la documentation et différents forum je n’arrive toujours pas à lier libxml2 à mon projet.
J'ai ceci comme code source :
Code:
1 2 3 4 5 6 7 8 9
|
#include <libxml++/libxml++.h>
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl; // prints !!!Hello World!!!
return 0;
} |
J'obtiens cette erreur à la compilation :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
**** Build of configuration Debug for project TEST_CPP ****
make all
Building file: ../src/TEST_CPP.cpp
Invoking: GCC C++ Compiler
g++ -I"/usr/include/libxml2 -I/usr/include/glibmm-2.4 -I/usr/lib/x86_64-linux-gnu/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libxml++-2.6 -I/usr/lib/libxml++-2.6/include -lxml++-2.6 -lxml2 -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lglib-2.0" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/TEST_CPP.d" -MT"src/TEST_CPP.d" -o "src/TEST_CPP.o" "../src/TEST_CPP.cpp"
../src/TEST_CPP.cpp:9:31: erreur fatale: libxml++/libxml++.h : Aucun fichier ou dossier de ce type
compilation terminée.
make: *** [src/TEST_CPP.o] Erreur 1
**** Build Finished **** |
J'ai bien installé les packages libxml++2.6-dev sous Ubuntu et toutes les dépendances. Pour ajouter à mon eclipse je fais comme ceci :
Code:
1 2 3 4 5 6 7 8 9
|
*pkg-config --cflags libxml-2.0*
Copy the output. (For example: * -I/usr/include/libxml2* )
Right-click your CDT project and select *Properties*.
Expand *C/C++ General* and select *Paths and Symbols*.
Select *GNU C++* under Languages
Click *Add* to define new element
Write in the Directory field what was the output of the pkg-config command without the -I prefix i.e: */usr/include/libxml2*
Re-build the ns-3 project. |
Ma ligne de compilation semble étrange cependant mais j'ai pas le niveau pour debug... Est-ce que vous voyez un soucis ? Vous avez réussi vous ?
En ligne de commande j'ai tapé ceci :
Code:
1 2 3 4
|
#pkg-config libxml++-2.6 --cflags --libs
-I/usr/include/libxml2 -I/usr/include/glibmm-2.4 -I/usr/lib/x86_64-linux-gnu/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libxml++-2.6 -I/usr/lib/libxml++-2.6/include -lxml++-2.6 -lxml2 -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lglib-2.0 |
Merci d'avance de votre aide