@dasoe wrote:
Hi all,
If I have a child class I can not use ofXml in this class.
The error I get is (when opening the App, compiling is OK)Unhandled exception at 0x00CA28BD in XXX.exe: 0xC0000005: Access violation reading location 0x00000000.
Line of code mentioned is:
ofXml::ofXml(const ofXml & rhs){ document = new Poco::XML::Document(); x Poco::XML::Node *n = document->importNode(rhs.getPocoDocument()->documentElement(), true); document->appendChild(n); element = document->documentElement(); }
Here's the setting. (I do nothing but declare an ofXml in the header file of the class - that's the culprit):
ofApp.h:
#pragma once #include "ofMain.h" #include "myClass.h" class ofApp : public ofBaseApp{ public: void setup(); void update(); void draw(); ofXml settingsXML; vector <myClass> content; };
ofApp.cpp:
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup(){ if (settingsXML.load("settings.xml")) { } content.assign(4, myClass()); for (int i = 0; i < content.size();i++) { content[i].init(); } } //-------------------------------------------------------------- void ofApp::update(){ } //-------------------------------------------------------------- void ofApp::draw(){ }
myClass.h:
#pragma once #include "ofMain.h" class ofApp; class myClass : public ofBaseApp { public: myClass(); void init(); ofXml classXML; };
myClass.cpp:
#include "myClass.h" myClass::myClass() { } void myClass::init() { }
is it possible to use ofXml here? If someone can explain my error, I'd be happy!
thanks & have a good day
oe
Posts: 1
Participants: 1