The application failed to initialize properly ( 0xc0000005). Click on OK to terminate
Hi,
I'm using moc to manually compile a set of classes with slots containing Q_OBJECT macro,
I have added the resulting cpp files to my project, and compiled the project, it has solved a bunch of vtable errors i had before but now when i run the program I get The application failed to initialize properly (0xc0000005). Click on OK to terminate the application.
Anybody know why this is?
here is my code
abstract class called resourcebox
Code:
/*
* ResourceBox.hpp
*
* Created on: 12-Sep-2008
* Author: Terabyte
*/
#ifndef RESOURCEBOX_HPP_
#define RESOURCEBOX_HPP_
#include <string>
#include <iostream>
#include <QObject>
using namespace std;
class ResourceBox
: public QObject{ Q_OBJECT
public slots:
virtual void execute()=0;
public:
ResourceBox();
virtual ~ResourceBox();
virtual string value() = 0;
};
#endif /* RESOURCEBOX_HPP_ */
and one of the concrete classes from resource box.
Code:
/*
* SvgBox.hpp
*
* Created on: 12-Sep-2008
* Author: Terabyte
*/
#ifndef SVGBOX_HPP_
#define SVGBOX_HPP_
/*
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/PlatformUtils.hpp>
*/
#include "XMLBox.hpp"
#include "ResourceBox.hpp"
using namespace xercesc_2_8;
using namespace std;
class SvgBox: public ResourceBox {
Q_OBJECT
public slots:
void execute();
private:
XMLBox* xmlBox;
DOMNode* node;
public:
SvgBox(XMLBox *box,DOMNode *domNode);
virtual ~SvgBox();
string value();
};
#endif /* SVGBOX_HPP_ */
and the treemodel which connects signals to slots :
Code:
/*
* TreeModel.cpp
*
* Created on: 26-Jul-2008
* Author: Terabyte
*/
#include <QtGui>
#include "TreeItem.hpp"
#include "TreeModel.hpp"
#include <iostream>
#include <QAbstractItemView>
using namespace std;
{
this->view = gview;
this->rootItem = NULL;
}
TreeModel::~TreeModel() {
// TODO Auto-generated destructor stub
delete rootItem;
}
int TreeModel
::columnCount(const QModelIndex &parent
) const {
if (parent.isValid())
return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
else
return rootItem->columnCount();
}
{
if (!index.isValid())
if (role != Qt::DisplayRole)
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
return item->data(index.column());
}
Qt
::ItemFlags TreeModel
::flags(const QModelIndex &index
) const {
if (!index.isValid())
return Qt::ItemIsEnabled;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
QVariant TreeModel
::headerData(int section, Qt
::Orientation orientation,
int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
return rootItem->data(section);
}
const
{
TreeItem *parentItem;
if (!parent.isValid())
parentItem = rootItem;
else
parentItem = static_cast<TreeItem*>(parent.internalPointer());
TreeItem *childItem = parentItem->child(row);
if (childItem)
return createIndex(row, column, childItem);
else
}
{
if (!index.isValid())
TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
TreeItem *parentItem = childItem->parent();
if (parentItem == rootItem)
return createIndex(parentItem->row(), 0, parentItem);
}
int TreeModel
::rowCount(const QModelIndex &parent
) const {
TreeItem *parentItem;
if (!parent.isValid())
parentItem = rootItem;
else
parentItem = static_cast<TreeItem*>(parent.internalPointer());
return parentItem->childCount();
}
void TreeModel
::setupModelData(const QStringList &lines, TreeItem
*parent
) {
}
void TreeModel::startTag(ResourceBox *resourcebox){
//create item, passing resourcebox, calling resourcebox display.
//add to parent stack
char x;
if (rootItem == NULL) {
cout << "root added";
cin >> x;
TreeItem *item = new TreeItem(resourcebox);
cin >> x;
rootItem = item;
cin >> x;
parents.push_back(item);
} else {
cin >> x;
cout << "non root added";
cin >> x;
TreeItem *item = new TreeItem(resourcebox,parents.last());
cin >> x;
parents.last()->appendChild(item);
cin >> x;
parents.push_back(item);
}
cin >> x;
this
->view
->connect
(this
->view,
SIGNAL(QTreeView::DoubleClicked()),resourcebox,
SLOT(execute
()));
resourcebox,SLOT(extecute())
);
cin >> x;
cout << "success";
}
void TreeModel::endTag(){
parents.pop_back();
}
void TreeModel::debug(){
cout << "Parents " << this->parents.size() << endl;
for (int i = 0; i < this->parents.size(); i++){
this->parents.at(i)->debug();
}
}
though there is only the connect function here and commenting it out doesnt fix it.
I am totally stuck on this one, dont know where to begin, thanks for any help
Re: The application failed to initialize properly ( 0xc0000005). Click on OK to termi
Please provide more information.
Which OS / compiler / additional DLLs?
I experienced this, when I used Qwt debug DLL with a release executable, e.g.
Regards,
Rainer
Re: The application failed to initialize properly ( 0xc0000005). Click on OK to termi
Quote:
Originally Posted by
RThaden
Please provide more information.
Which OS / compiler / additional DLLs?
I experienced this, when I used Qwt debug DLL with a release executable, e.g.
Regards,
Rainer
XP
Cygwin (G++)
Eclipse latest
No 'additional' dll's just the qt ones as added to the path variable
Re: The application failed to initialize properly ( 0xc0000005). Click on OK to termi
If you haven't already done that:
When you enter
"The application failed to initialize properly (0xc0000005)" cygwin qt
in google, you find some issues related to cygwin and qt and this error
Rainer
Re: The application failed to initialize properly ( 0xc0000005). Click on OK to termi
I had a same problem ("The application failed to initialize properly (0xc0000005)") but with mingw.
Was my fault - forgetting to initialize the pointer with new before using it :p!
Re: The application failed to initialize properly ( 0xc0000005). Click on OK to termi
Quote:
Originally Posted by
RThaden
If you haven't already done that:
When you enter
"The application failed to initialize properly (0xc0000005)" cygwin qt
in google, you find some issues related to cygwin and qt and this error
Rainer
Hi, thanks for the reply, and yes I have checked that with no luck, or at least one of those results is mine on another forum, and hasn't received a response.
The other one that seems close is
http://lists.trolltech.com/qt-intere...ad00315-0.html
The original post is compiling qt on cygwin, and just - as most conversations about cygwin - resulted in some prat asking 'why would you want to do that' rather than knuckling down and answering the question. :(
Just for more information, If I remark out Q_OBJECT everything compiles and runs but I get the error along the lines of "something regarding slots/signals does not exist" which is fair, since it doesn't because the Q_OBJECT macro has been omitted. So pretty the error I get happens if I don't comment out Q_OBJECT.