BehaviorTree.CPP icon indicating copy to clipboard operation
BehaviorTree.CPP copied to clipboard

About the interface createTreeFromFile

Open LuossD opened this issue 3 years ago • 2 comments

terminate called after throwing an instance of 'BT::RuntimeError' what(): Error parsing the XML: XML_ERROR_FILE_NOT_FOUND

This may be a simple problem, but I can't find a solution and hope to get a reply.Thanks!

LuossD avatar Sep 19 '22 09:09 LuossD

This means that the XML file wasn't present in the path you provided. For instance, if this is how you use your XML file factory.createTreeFromFile("./bt_tree.xml") Then the file wasn't in the current directory (assuming you ran from the same directory)

Please bear in mind that the path above should be relative to the directory you run from.

thehummingbird avatar Sep 20 '22 21:09 thehummingbird

This means that the XML file wasn't present in the path you provided. For instance, if this is how you use your XML file factory.createTreeFromFile("./bt_tree.xml") Then the file wasn't in the current directory (assuming you ran from the same directory)

Please bear in mind that the path above should be relative to the directory you run from.

My .cpp file and XML file are in the same directory, I call the factory. CreateTreeFromFile (". / bt_tree. XML ") in the .cpp file, reported this error, so is the relative path relative to this CPP file or something else? I'm so confused, thanks for your reply.

LuossD avatar Sep 23 '22 02:09 LuossD

It doesn't depend on the location of your cpp file but the current working directory when you're running your executable. Let's say you have your executable ready after running the makefile and you run it, your CURRENT WORKING DIRECTORY (when you use your executable) should have bt_tree.xml, in your case.

thehummingbird avatar Sep 23 '22 21:09 thehummingbird

It doesn't depend on the location of your cpp file but the current working directory when you're running your executable. Let's say you have your executable ready after running the makefile and you run it, your CURRENT WORKING DIRECTORY (when you use your executable) should have bt_tree.xml, in your case. I did put the XML file in the same directory as the executable, but it's still the same error.I succeeded with absolute paths.

LuossD avatar Sep 29 '22 07:09 LuossD

Thanks to other for answering this question. Closing

facontidavide avatar Oct 24 '22 10:10 facontidavide