C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 25th, 2003, 10:19 PM
maskzilla maskzilla is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 maskzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #2  
Old February 25th, 2003, 11:16 PM
7stud 7stud is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2001
Posts: 1,365 7stud User rank is Private First Class (20 - 50 Reputation Level)7stud User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 18 h 9 m 25 sec
Reputation Power: 14
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.

Reply With Quote
  #3  
Old February 25th, 2003, 11:30 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,382 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 20 h 31 m 48 sec
Reputation Power: 4080
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!

Reply With Quote
  #4  
Old February 25th, 2003, 11:32 PM
maskzilla maskzilla is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 maskzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
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 :-\

Reply With Quote
  #5  
Old February 25th, 2003, 11:35 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,382 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 20 h 31 m 48 sec
Reputation Power: 4080
>> 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

Reply With Quote
  #6  
Old February 26th, 2003, 12:11 AM
7stud 7stud is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2001
Posts: 1,365 7stud User rank is Private First Class (20 - 50 Reputation Level)7stud User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 18 h 9 m 25 sec
Reputation Power: 14
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.

Reply With Quote
  #7  
Old February 26th, 2003, 12:52 AM
maskzilla maskzilla is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 maskzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
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

Reply With Quote
  #8  
Old February 26th, 2003, 01:01 AM
maskzilla maskzilla is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 maskzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #9  
Old February 26th, 2003, 03:20 AM
7stud 7stud is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2001
Posts: 1,365 7stud User rank is Private First Class (20 - 50 Reputation Level)7stud User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 18 h 9 m 25 sec
Reputation Power: 14
"Ctrl + Alt +Print Screen"

Nothing happens. I tried it on the devshed forum screen. Do I have to have my cursor somewhere special?

Reply With Quote
  #10  
Old February 26th, 2003, 03:33 AM
7stud 7stud is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2001
Posts: 1,365 7stud User rank is Private First Class (20 - 50 Reputation Level)7stud User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 18 h 9 m 25 sec
Reputation Power: 14
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.

Reply With Quote
  #11  
Old February 26th, 2003, 03:58 PM
maskzilla maskzilla is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 maskzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
anyone? :-[

Reply With Quote
  #12  
Old February 26th, 2003, 04:25 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,382 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 20 h 31 m 48 sec
Reputation Power: 4080
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.

Reply With Quote
  #13  
Old February 26th, 2003, 04:27 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,382 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 20 h 31 m 48 sec
Reputation Power: 4080
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.

Reply With Quote
  #14  
Old February 26th, 2003, 09:13 PM
maskzilla maskzilla is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 maskzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
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

Reply With Quote
  #15  
Old February 26th, 2003, 11:01 PM
7stud 7stud is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2001
Posts: 1,365 7stud User rank is Private First Class (20 - 50 Reputation Level)7stud User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 18 h 9 m 25 sec
Reputation Power: 14
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;

}

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Debug assertion error ?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap