/usr/bin/ld: /tmp/ccmzZd4x.o: undefined reference to symbol 'xmlParseFile@@LIBXML2_2.4.30'
时间: 2023-10-03 18:09:47 浏览: 119
This error message indicates that the linker (ld) was unable to find a reference to the xmlParseFile function from the LIBXML2 library version 2.4.30.
To fix this issue, you need to ensure that the LIBXML2 library is installed and available in the linker search path. You may also need to specify the library path and version explicitly using the -L and -l options respectively.
Here's an example command that links against the LIBXML2 library:
gcc -o myprogram myprogram.c -L/usr/lib -lxml2
This assumes that the LIBXML2 library is installed in the /usr/lib directory. If it's installed elsewhere, you'll need to adjust the -L option accordingly.
Alternatively, you can use pkg-config to determine the correct compiler and linker flags for the LIBXML2 library:
gcc -o myprogram myprogram.c $(pkg-config --cflags --libs libxml-2.0)