我已经安装了连接到远程构建主机(我的虚拟机)的 Netbeans 7.1.1。我试图编译我在某个网站上找到的一些程序。
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
// Appelée à la rencontre de chaque balise ouvrante
void debut_element(void *user_data, const xmlChar *name, const xmlChar **attrs) {
printf("Début de l'élément : %s\n", name);
}
int main() {
// Initialisation à zéro de tous les membres (NULL pour un pointeur par conversion)
xmlSAXHandler sh = { 0 };
// Affectation des fonctions de rappel
sh.startElement = debut_element;
xmlParserCtxtPtr ctxt;
// Création du contexte
if ((ctxt = xmlCreateFileParserCtxt("catalogue.xml")) == NULL) {
fprintf(stderr, "Erreur lors de la création du contexte\n");
return EXIT_FAILURE;
}
// Fonctions de rappel à utiliser
ctxt->sax = &sh;
// Analyse
xmlParseDocument(ctxt);
// Le document est-il bien formé ?
if (ctxt->wellFormed) {
printf("Document XML bien formé\n");
} else {
fprintf(stderr, "Document XML mal formé\n");
xmlFreeParserCtxt(ctxt);
return EXIT_FAILURE;
}
// Libération de la mémoire
xmlFreeParserCtxt(ctxt);
return EXIT_SUCCESS;
}
但是,我在编译期间收到此错误消息
Copying project files to /home/saebyuk/.netbeans/remote/redHat/saebyuk-pc-Windows-x86/ at saebyuk@redHat
"/usr/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
gmake[1]: Entering directory `/home/saebyuk/.netbeans/remote/redHat/saebyuk-pc-Windows-x86/C/Users/saebyuk/Documents/NetBeansProjects/xml_decoder_Red_hat'
"/usr/bin/gmake" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/xml_decoder_red_hat
gmake[2]: Entering directory `/home/saebyuk/.netbeans/remote/redHat/saebyuk-pc-Windows-x86/C/Users/saebyuk/Documents/NetBeansProjects/xml_decoder_Red_hat'
gmake[2]: Warning: File `main.cpp' has modification time 2.1e+04 s in the future
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/main.o.d
g++ -c -g -Wall -I/usr/include/libxml2 -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++ -I/usr/include/libxml2 -o dist/Debug/GNU-Linux-x86/xml_decoder_red_hat build/Debug/GNU-Linux-x86/main.o
build/Debug/GNU-Linux-x86/main.o: In function `main':
/home/saebyuk/.netbeans/remote/redHat/saebyuk-pc-Windows-x86/C/Users/saebyuk/Documents/NetBeansProjects/xml_decoder_Red_hat/main.cpp:35: undefined reference to `xmlCreateFileParserCtxt'
/home/saebyuk/.netbeans/remote/redHat/saebyuk-pc-Windows-x86/C/Users/saebyuk/Documents/NetBeansProjects/xml_decoder_Red_hat/main.cpp:40: undefined reference to `xmlParseDocument'
/home/saebyuk/.netbeans/remote/redHat/saebyuk-pc-Windows-x86/C/Users/saebyuk/Documents/NetBeansProjects/xml_decoder_Red_hat/main.cpp:46: undefined reference to `xmlFreeParserCtxt'
collect2: ld returned 1 exit status
gmake[2]: *** [dist/Debug/GNU-Linux-x86/xml_decoder_red_hat] Error 1
gmake[2]: Leaving directory `/home/saebyuk/.netbeans/remote/redHat/saebyuk-pc-Windows-x86/C/Users/saebyuk/Documents/NetBeansProjects/xml_decoder_Red_hat'
gmake[1]: *** [.build-conf] Error 2
gmake[1]: Leaving directory `/home/saebyuk/.netbeans/remote/redHat/saebyuk-pc-Windows-x86/C/Users/saebyuk/Documents/NetBeansProjects/xml_decoder_Red_hat'
gmake: *** [.build-impl] Error 2
我知道这已经在这里被问了数千次,但我找不到正确的答案。感谢你们中的任何人可以指导我,因为我是新手。