Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    11
    Rep Power
    0

    Debug assertion error ?


    When i try to execute my .exe it doesnt work after i compile it
    all the information can be seen at :
    http://www.pixelsonmy.tv/help/

    there is the error i get (a pic of the screen shot)

    any ideas on what is wrong?

    im runnin VSC++ 6.0 on windows XP
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,481
    Rep Power
    15
    Some possibilities:

    1) m = new double [rows*columns];

    You don't check to see whether m is null or not. Maybe your new request didn't return a valid address?

    2)void matrix::set_val(int r, int c, double d){
    m[rows * columns + columns] = d;
    }

    Your array index goes out of bounds in your loop, and even though that's not illegal, so your program will compile, maybe that's causing a memory problem when you run your program.
    Last edited by 7stud; February 25th, 2003 at 11:26 PM.
  4. #3
  5. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,616
    Rep Power
    4247
    Couple of things I saw right away were --

    In main.cpp
    Code:
    matrix M1(3,3);
    matrix M2(3,3);
    
    for (int i = 0; i < 9; i++)
    	M1.set_val(i, i, 2);
    You're setting M1 to a 3x3 matrix. However, in the for loop right afterwards, you're overrunning a buffer. Your for loop variable goes from 0..8 and you're attempting to access stuff like M1(8,8) when your matrix's max is M1(2,2).

    Also in matrix.cpp, you have:
    Code:
    void matrix::set_val(int r, int c, double d){
    	m[rows * columns + columns] = d;
    }
    I think you really meant this to be:
    Code:
    void matrix::set_val(int r, int c, double d){
    	m[r * columns + c] = d;
    }
    BTW your code for operator /= is incorrect as well. There's a logic error in that function, that I trust you'll have no problems finding. Hope this helps! :)
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    11
    Rep Power
    0
    Originally posted by 7stud
    Some possibilities:

    1) m = new double [rows*columns];

    You don't check to see whether m is null or not. Maybe your new request didn't return a valid address?

    2)void matrix::set_val(int r, int c, double d){
    m[rows * columns + columns] = d;
    }

    Your array index goes out of bounds in your loop, and even though that's not illegal, so your program will compile, maybe that's causing a memory problem when you run your program.
    thank you, i fixed the problem with number 2, im not longer getting that debug anymore, now it just crashes :-\
  8. #5
  9. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,616
    Rep Power
    4247
    >> im not longer getting that debug anymore, now it just crashes :-\
    Probably cuz your for loop in main.cpp goes from 0..8. Try changing it to:
    for (int i=0; i < 3; i++)

    Also note the other errors I found in your code, in my prev. post on this thread :)
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,481
    Rep Power
    15
    maskzilla,

    Can you tell me how you did that screen capture? At work, I used to be able to do screen captures of some information in an app, and then save it to look at the next day, but I can't seem to figure out how to do that on my pc at home.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    11
    Rep Power
    0
    Originally posted by 7stud
    maskzilla,

    Can you tell me how you did that screen capture? At work, I used to be able to do screen captures of some information in an app, and then save it to look at the next day, but I can't seem to figure out how to do that on my pc at home.
    Ctrl + Alt +Print Screen, then i just Choose New in Adobe Photoshop, and pasted, i think you can paste in Word too tho
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    11
    Rep Power
    0
    hmm okay, i fixed what i think was the problem, now it runs.. just doesnt do anything :-\ i re-uploaded the fixed pages
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,481
    Rep Power
    15
    "Ctrl + Alt +Print Screen"

    Nothing happens. I tried it on the devshed forum screen. Do I have to have my cursor somewhere special?
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,481
    Rep Power
    15
    Ahhhah! Print Scrn(I didn't have to press Ctrl + Alt + Print Scrn just Print Scrn) may appear to do nothing but it sends the contents of the active window to your clipboard which I was then able to paste into Word. Thanks.
  20. #11
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    11
    Rep Power
    0
    anyone? :-[
  22. #12
  23. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,616
    Rep Power
    4247
    Dude, you still didn't fix the bugs in your operator /= function yet -- check it carefully and you'll see what the problem is. Also you need to reset your matrix M1 after you declare it (and before calling set_val), so that you know you have 0 for the rest of the elements.
    Code:
    matrix M1(3,3);
    
    M1.reset(); // Set all the elements to 0 initially to be safe
    for (int i=0; i < 3; i++) // <-- you've got this going one less BTW
     ....
    How do I know that this will work. Because I FIXED them last night on my end and got your code to work perfectly.
  24. #13
  25. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,616
    Rep Power
    4247
    7stud -- I believe the command is Alt-PrtScrn. PrtScrn by itself captures the entire desktop to the clipboard. Alt-PrtScrn captures only the active window to the clipboard.
  26. #14
  27. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    11
    Rep Power
    0
    Originally posted by Scorpions4ever
    Dude, you still didn't fix the bugs in your operator /= function yet -- check it carefully and you'll see what the problem is.

    duuuuuuuuuuh thank you.. im an idiot
  28. #15
  29. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,481
    Rep Power
    15
    You only tell your program to output "finished" to the screen:

    void main(){

    matrix M1(3,3);
    matrix M2(3,3);

    for (int i = 0; i < 2; i++)
    M1.set_val(i, i, 2);

    M1 /= .03;
    cout << "finished" << endl;

    }
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo