Samsung Bada Osp::Xml Build Problems
Pasted from my previous blog on 2 August 2010.
Since one last month I discover new mobile platform from Samsung, Bada. With basic skill as amateur Java Programmer I just have very basic skill in c/c++ programming that is used as lingua franca of Bada. Perhaps I know little bit knowledge about pointer. But I lost when need to discover build, link related problem.
One time I need to build application that have parse xml. I put the xml code in OnInitializing method that is extends from Osp::Ui::Controls::Form and I also not forget to include FXml.h at my header file and using namespace Osp::Xml in my cpp file. Here is snapshot of the code:
result MyXmlForm::OnInitializing(void) {xmlDoc* doc = null;xmlXPathContextPtr xpathCtx;xmlXPathObjectPtr xpathObj;doc = xmlReadFile(“/Home/test.xml”, null, 0); // error hereif (doc == NULL) {AppLog(“Failed to load xml doc!”);}xpathCtx = xmlXPathNewContext(doc); // errorif (xpathCtx == NULL) {AppLog(“Error: unable to create new XPATH context”);xmlFreeDoc(doc); //errorreturn (E_IO);}xpathObj = xmlXPathEvalExpression((xmlChar*) “//title”, xpathCtx); //errorif (xpathObj == NULL) {AppLog(“Error: unable to evaluate xpath expression”);xmlXPathFreeContext(xpathCtx);xmlFreeDoc(doc);return (E_IO);}get_xpath_titles(xpathObj->nodesetval);xmlFreeDoc(doc); // errorxmlCleanupParser(); // errorreturn E_SUCCESS;}
Here are the errors:
undefined reference to xmlReadFile' undefined reference to
xmlFreeDoc’
undefined reference to xmlXPathNewContext’ undefined reference to
xmlXPathEvalExpression’
undefined reference to xmlXPathFreeContext’ undefined reference to
xmlCleanupParser’
This evening I spent about two hour to make above code work. Like I have said, Bada itself actually has provide xml library with namespace Osp::Xml which is subset from libxml2. When I finish type the code I stuck when have to face undefined reference to bla bla bla error relate to method call from Osp::Xml. I already make sure that I have include FXml.h in my header declaration and also state using namespace Osp::Xml in my source code. After spending sometime researching with very minimum information from Bada Documentation and also all internet site I found I need to link FXml library in project properties. Then build problem dissapear and my code can run smooth now. Yippie.