C++ error: "Unhandled exception at" Visual Studio

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Vortex
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 70
Joined: Sat Nov 15, 2008 1:00 pm

C++ error: "Unhandled exception at" Visual Studio

Post by Vortex »

Unhandled exception at 0x6812851a in Editor.exe: 0xC0000005: Access violation reading location 0x0000323c.
when i try to run my program ( level editor ) from visual studio i get this error,
i have no idea how to fix this,

all info i can give is that it stops execution and show me this line of code
SDL_FillRect( screen, &screen->clip_rect, SDL_MapRGB( screen->format, 0xFF, 0xFF, 0xFF ) );

i dont see anything wrong with it and when i remove it it just sais the error is in another line of code,
TorteXXX
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: C++ error: "Unhandled exception at" Visual Studio

Post by K-Bal »

Have you tried running it with a debugger?
User avatar
Vortex
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 70
Joined: Sat Nov 15, 2008 1:00 pm

Re: C++ error: "Unhandled exception at" Visual Studio

Post by Vortex »

i run it with debug mode in visual studio if thats what you mean? :oops:
TorteXXX
User avatar
Bludklok
Chaos Rift Junior
Chaos Rift Junior
Posts: 241
Joined: Tue Apr 14, 2009 1:31 am
Current Project: EnigmaCore
Favorite Gaming Platforms: PC, N64, Playstation1, Playstation2
Programming Language of Choice: C++
Location: New Jersey
Contact:

Re: C++ error: "Unhandled exception at" Visual Studio

Post by Bludklok »

We need some more source code...

Btw double check to make sure you declared all of the variables you are trying to use. (Make sure they have values and what not)
Youtube
Website
Current project: Enigma Core
User avatar
Vortex
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 70
Joined: Sat Nov 15, 2008 1:00 pm

Re: C++ error: "Unhandled exception at" Visual Studio

Post by Vortex »

since i didint know what was wrong in the code i just uploaded all,
its mostly copied functions from lazy foo so thoose functions should be working i think
http://bitfile.se/files/p/Source.zip
TorteXXX
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: C++ error: "Unhandled exception at" Visual Studio

Post by K-Bal »

With a debugger you can step through your program linewise and get other useful information. It's not running the program in debug mode, but debug mode is important for the debugger to work correctly.
User avatar
Vortex
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 70
Joined: Sat Nov 15, 2008 1:00 pm

Re: C++ error: "Unhandled exception at" Visual Studio

Post by Vortex »

is there a debugger in visual studio? how do i use it?
any other anwsers on my problem? :(
TorteXXX
User avatar
Bakkon
Chaos Rift Junior
Chaos Rift Junior
Posts: 384
Joined: Wed May 20, 2009 2:38 pm
Programming Language of Choice: C++
Location: Indiana

Re: C++ error: "Unhandled exception at" Visual Studio

Post by Bakkon »

Yes, there's a debugger in Visual Studio. There should be a tab up top with all your debug tools.

This won't help your current problem, but a small tip...

Code: Select all

SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0xFF, 0xFF, 0xFF));
...will fill the entire surface, in your case, the whole screen.
User avatar
Vortex
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 70
Joined: Sat Nov 15, 2008 1:00 pm

Re: C++ error: "Unhandled exception at" Visual Studio

Post by Vortex »

yeah, i dont see anything wrong with that line? ive tryed to remove it but i still get the error?
any hints?
TorteXXX
User avatar
Bakkon
Chaos Rift Junior
Chaos Rift Junior
Posts: 384
Joined: Wed May 20, 2009 2:38 pm
Programming Language of Choice: C++
Location: Indiana

Re: C++ error: "Unhandled exception at" Visual Studio

Post by Bakkon »

Only thing I can think of is you didn't use SDL_SetVideoMode on the screen. We can't do much more for you without seeing some source or given better detail on the error.
User avatar
Vortex
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 70
Joined: Sat Nov 15, 2008 1:00 pm

Re: C++ error: "Unhandled exception at" Visual Studio

Post by Vortex »

source already linked
TorteXXX
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: C++ error: "Unhandled exception at" Visual Studio

Post by dandymcgee »

Vortex wrote:source already linked
Not much use missing half of the files ( test.map, tileSheet.png, project file ).
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Vortex
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 70
Joined: Sat Nov 15, 2008 1:00 pm

Re: C++ error: "Unhandled exception at" Visual Studio

Post by Vortex »

the map file is supposed to be generated by the editor.
http://bitfile.se/files/p/tileSheet.png
tile sheet. not so high class but im actually proud for being the first tile like thing i ever drawn
http://bitfile.se/files/p/rar.rar
projekt file.
TorteXXX
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: C++ error: "Unhandled exception at" Visual Studio

Post by dandymcgee »

Vortex wrote:the map file is supposed to be generated by the editor.
http://bitfile.se/files/p/tileSheet.png
tile sheet. not so high class but im actually proud for being the first tile like thing i ever drawn
http://bitfile.se/files/p/rar.rar
projekt file.
Compiles and runs fine for me in Code::Blocks. Not sure what's up.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: C++ error: "Unhandled exception at" Visual Studio

Post by MarauderIIC »

Vortex wrote:is there a debugger in visual studio? how do i use it?
any other anwsers on my problem? :(
http://www.lmgtfy.com/?q=using+debugger+in+visual+c%2B%2B
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Post Reply