![]() |
| | #1 |
| Registered User Join Date: Dec 2007
Posts: 78
| debug assertion failed! Code: Section defGeometry::formSection( Side Section1,Section Section2,int N1,int N2,int N4,int NumberOfPoints )
{defFile defG;
//std::vector Sections FinalSection;
int NoOfPoints,i,j,k;
N1=2;
N2=2;
j=0;
k=0;
NoOfPoints=2*N1;
struct Section defGeomSecTemp;
struct point x;
double defGeompt[3];
for(i=0;i<N4;i++)
{
for(j=NumberOfPoints-N2;j>=NumberOfPoints-N2;j++)
{
x.pt[0]=Section1.Sections[N4].Points[NumberOfPoints-N2].pt[0];
}
}
return Section3;
};
error debug assertion failed! vector subscript out of range |
| chintugavali is offline | |
| | #2 |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,381
| |
| brewbuck is offline | |
| | #3 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| You have a vector with X elements, and you are trying to "use" elements beyond X. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #4 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| Again, you should check your subscripts. I don't know what the actual cause of your problem is, because that code doesn't make any sense. I'm hoping and wishing that what you've posted is not, in fact, your actual code, because otherwise you've got a lot of things missing. In future, post actual code. |
| tabstop is offline | |
| | #5 |
| Registered User Join Date: Dec 2007
Posts: 78
| Thanks experts! i have got the solution!! thank you very much! |
| chintugavali is offline | |
| | #6 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,099
| Code: Section defGeometry::formSection( Side Section1,Section Section2,int N1,int N2,int N4,int NumberOfPoints )
{
defFile defG;
//std::vector Sections FinalSection;
int NoOfPoints,i,j,k;
N1=2;
N2=2;
j=0;
k=0;
NoOfPoints=2*N1;
struct Section defGeomSecTemp;
struct point x;
double defGeompt[3];
for(i=0;i<N4;i++)
{
for(j=NumberOfPoints-N2;j>=NumberOfPoints-N2;j++)
{
x.pt[0]=Section1.Sections[N4].Points[NumberOfPoints-N2].pt[0];
}
}
return Section3;
};
Since a function is a block, indent all code inside it at least once. And typing "struct" before the struct name is not required in C++, so you can drop it.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Debug Assertion Failed! | IndioDoido | C Programming | 31 | 03-25-2008 11:07 AM |
| Visual Studio 2005 Debug Assertion Failed | natmas | C++ Programming | 7 | 07-17-2007 04:28 PM |
| debug assertion failed ! | blue_gene | C++ Programming | 2 | 05-09-2004 11:23 AM |
| Debug Assertion Failed! | Ray Schmidt | C++ Programming | 3 | 02-21-2003 09:58 PM |
| Debug Assertion Failed | minesweeper | Windows Programming | 5 | 12-11-2002 05:11 PM |