I am using vector in my code but when application is running it causes system error/crash.
Code in .h file :
#include <vector>
using namespace std;
bool callVector(vector<float>&);
void func();
vector <float> vectorname;
#include <vector>
using namespace std;
bool callVector(vector<float>&);
void func();
vector <float> vectorname;
To copy to clipboard, switch view to plain text mode
Code in .cpp file:
void myClass::func()
{
if(!callVector(vectorname))
{
qDebug() << " vector error" ;
}
else
{
qDebug()<<"vector success" ;
qDebug()<<"vector [0]" : << vectorname[0]; //**system error/crash HERE **
}
}
void myClass::func()
{
if(!callVector(vectorname))
{
qDebug() << " vector error" ;
}
else
{
qDebug()<<"vector success" ;
qDebug()<<"vector [0]" : << vectorname[0]; //**system error/crash HERE **
}
}
To copy to clipboard, switch view to plain text mode
System error/crash at line 10 in .cpp.
Application output:
vector success
.exe exited with code -1073741819
Bookmarks