am trying to read an xml file in visual studio using the pugixml parser. i have downloaded the parser. but am wondering how i can link it with my c++ code. like how to configure the include directories.here is my code
#include "pugixml.hpp"
#include <iostream>
using namespace std;
int main()
{
pugi::xml_document doc;
doc.load_file("XML.xml"); //Load xml file
pugi::xml_node efruit = doc.first_child().child("fruit"); //get the child fruit of first child of a xml document i.e file
while (efruit != NULL)
{
pugi::xml_node fName = efruit.child("name"); //get the name child of fruit
if (fName != NULL)
{
cout << fName.text().get(); //print the name of fruit i.e text of name
}
pugi::xml_node fColor = efruit.child("color"); //get the color child of fruit
if (fColor != NULL)
{
cout << " " << fColor.text().get(); //print the color of fruit i.e text of color
}
cout << endl;
efruit = efruit.next_sibling("fruit"); //get the sibling of fruit i.e next fruit
}
return 0;
}
pacmanto installpugixmllike the VSCode directions told you to install MinGW usingpacman: https://packages.msys2.org/package/mingw-w64-ucrt-x86_64-pugixml?repo=ucrt64 you will not have to modify include directories or library directories but you will have to edit your tasks.json to link to this file/ucrt64/lib/libpugixml.a