Re: Debug Assertion Failed
Yes, you made a mistake somewhere. Maybe not in that little bit of code, though. Read my sig - you should seek to provide a *complete* example.
If your code is crashing then it would be useful to provide a stack trace and indicate in your code where the relevant lines are.
Have you used your debugger yet? What have you found so faR?
5 Attachment(s)
Re: Debug Assertion Failed
when I build in debug mode everything is fine... but when in release mode this error coming up...
btw in application output i found this...
Starting C:\Users\beethoven07\Documents\QT programming\loginform-build-Desktop_Qt_5_0_1_MSVC2010_32bit-Release\release\loginform.exe...
The program has unexpectedly finished.
C:\Users\beethoven07\Documents\QT programming\loginform-build-Desktop_Qt_5_0_1_MSVC2010_32bit-Release\release\loginform.exe exited with code 62097
this my complete code...
loginform.pro
Code:
#-------------------------------------------------
#
# Project created by QtCreator 2013-02-21T10:56:20
#
#-------------------------------------------------
QT += core gui sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = loginform
TEMPLATE = app
SOURCES += main.cpp\
dialog.cpp
HEADERS += dialog.h
FORMS += dialog.ui
dialog.h
Code:
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
#include <QDebug>
#include <QtSql>
#include <QMessageBox>
#include <QFileInfo>
namespace Ui {
class Dialog;
}
{
Q_OBJECT
public:
explicit Dialog
(QWidget *parent
= 0);
~Dialog();
private slots:
void on_btnClear_clicked();
void on_btnLogin_clicked();
private:
Ui::Dialog *ui;
};
#endif // DIALOG_H
dialog.cpp
Code:
#include "dialog.h"
#include "ui_dialog.h"
#define path_to_db "C:/Users/beethoven07/Documents/myDbVic/myDBvic.s3db"
ui(new Ui::Dialog)
{
ui->setupUi(this);
myDB.setDatabaseName (path_to_db);
if(checkFile.isFile())
{
if(myDB.open())
{
ui->lblStatus->setText("berhasil konek database");
}
}else
{
ui->lblStatus->setText("nda ta konek di database :(");
}
}
Dialog::~Dialog()
{
delete ui;
qDebug()<< "keluar dari database pada waktu program di matikan";
myDB.close();
}
void Dialog::on_btnClear_clicked()
{
ui->txtPassword->setText("");
ui->txtUsername->setText("");
}
void Dialog::on_btnLogin_clicked()
{
username = ui->txtUsername->text();
password = ui->txtPassword->text();
if(!myDB.isOpen()) {
qDebug() << "No connection to DB :(";
return;
}
if(qry.exec("SELECT username, password, Role FROM loginform WHERE username='" + username +
"\' AND password=\'" + password + "\'"))
{
if(qry.next())
{
ui->lblStatus ->setText("username dan password benar");
QString msg
= "username = " +qry.
value(0).
toString() + "\n" + "password = " +qry.value(1).toString() + "\n" +
"role = " +qry.value(2).toString();
} else {
ui->lblStatus->setText("Sala Password atau username bego");
}
}
}
main.cpp
Code:
#include "dialog.h"
#include <QApplication>
int main(int argc, char *argv[])
{
Dialog w;
w.show();
return a.exec();
}
thx....
Re: Debug Assertion Failed
Please attach debugger when you get the crash and show the stack trace. You should double check your usages of pointers - you are probably using an initialized one.
Re: Debug Assertion Failed
by the way how to set up the debbuger, when i want to debbug, ive this message No Debbuger Setup.... Im so newbie for using QT, btw im sorry for my bad English.... currently im using QT 5 and visual studio 2010.....
Re: Debug Assertion Failed
Quote:
and visual studio 2010.....
I am sure that somewhere in the help for Microsoft's Visual Studio product it tells you how to configure the Microsoft debugger in the Microsoft IDE.
Re: Debug Assertion Failed
Quote:
Originally Posted by
ChrisW67
thank you mate... i will chek it up....
Re: Debug Assertion Failed
" ive this message No Debbuger Setup"
Where does that message come from?
1 Attachment(s)
Re: Debug Assertion Failed
Quote:
Originally Posted by
amleto
" ive this message No Debbuger Setup"
Where does that message come from?
the message comes from here...
Attachment 8758
btw im stuck till now... please help me...
Re: Debug Assertion Failed
That's not visual studio, is it!? That's qt creator.
Firstly, did you compile qt with Microsoft compiler or mingw compiler? If the former, then please google qt creator Microsoft debugging.
Re: Debug Assertion Failed
Yes... it is QT creator... how can I debug in QT creator with vs2010, to trace where if i do something wrong with the code or something else.... ive download QT 5 with vs2010 not minGW...
Re: Debug Assertion Failed
Quote:
Originally Posted by
amleto
That's not visual studio, is it!? That's qt creator.
Firstly, did you compile qt with Microsoft compiler or mingw compiler? If the former, then please google qt creator Microsoft debugging.
Quote:
Originally Posted by
beethoven07
Yes... it is QT creator... how can I debug in QT creator with vs2010, to trace where if i do something wrong with the code or something else.... ive download QT 5 with vs2010 not minGW...
Quote:
Originally Posted by
amleto
That's not visual studio, is it!? That's qt creator.
Firstly, did you compile qt with Microsoft compiler or mingw compiler? If the former, then please google qt creator Microsoft debugging.
Please read more carefully.
3 Attachment(s)
Re: Debug Assertion Failed
this the error maybe this can help:
Attachment 8759
Attachment 8760
the full traced code here:
Attachment 8761
1 Attachment(s)
Re: Debug Assertion Failed
the problem isn't microsoft code, so there is no benefit to be gained from you showing us microsoft source code. show us YOUR CODE where the error happens.
Show a *call stack* AKA *stack trace*. Google it if you don't know what that is.
the problem isn't microsoft code, so there is no benefit to be gained from you showing us microsoft source code. show us YOUR CODE where the error happens.
Show a *call stack* AKA *stack trace*. Google it if you don't know what that is.
Added after 9 minutes:
Attachment 8762
That is a call stack.