Click here to Skip to main content
14,828,012 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
i have this error

SQL
First-chance exception at 0x00000000 in hw0-windows.exe: 0xC0000005: Access violation executing location 0x00000000.

If there is a handler for this exception, the program may be safely continued.



how can i fix it ?????
Posted

You can fix this error by not reading from, or writing to, address 0, by the agency of calling through a NULL pointer in this case.
In order to be more specific I would need to be able to see your code and know which line or lines are causing this error.
   
Comments
samad_najjar 19-Mar-13 6:51am
   
GLuint initshaders (GLenum type, const char *filename)
{
// Using GLSL shaders, OpenGL book, page 679

GLuint shader = glCreateShader(type) ; ///// error line
GLint compiled ;
string str = textFileRead (filename) ;
GLchar * cstr = new GLchar[str.size()+1] ;
const GLchar * cstr2 = cstr ; // Weirdness to get a const char
strcpy(cstr,str.c_str()) ;
glShaderSource (shader, 1, &cstr2, NULL) ;
glCompileShader (shader) ;
glGetShaderiv (shader, GL_COMPILE_STATUS, &compiled) ;
if (!compiled) {
shadererrors (shader) ;
throw 3 ;
}
Matthew Faithfull 19-Mar-13 7:07am
   
It would be better to add the code to the original question, makes it easier to read with formatting as well. However if I'm reading this right it's the call to
glCreateShader( type )
that is throwing this error. If so then something in your setting up of OpenGL is wrong. Either the OpenGL headers don't match your hardware, include paths are wrong or something is properly "£$!%!^%ed. You might want to tag your question as OpenGL too so anyone who knows about OpenGL will take interest.
At a guess I would say you may have the same problem as mentioned here:
http://stackoverflow.com/questions/12329082/glcreateshader-is-crashing
If not then you've exhausted my OpenGL knowledge.
Eugen Podsypalnikov 19-Mar-13 7:13am
   
// http://stackoverflow.com/questions/12329082/glcreateshader-is-crashing
Most likely :)
samad_najjar 19-Mar-13 7:15am
   
my hole code is here U can download it
http://s2.picofile.com/file/7693572361/aaaaa.rar.html
samad_najjar 19-Mar-13 7:22am
   
http://s2.picofile.com/file/7693572361/aaaaa.rar.html
click on "دریافت فایل"
1. Get the "story" of the exception:
Go to Debug->Exceptions dialog an check the all options in:



then observe the "story" at the exception stop in the Debug->CallStack window

2. Modify the "story" at your line(s) (mostly the top line of your code in the CallStack window)

3. Rebuild the "story" and try again :)
   
Comments
samad_najjar 19-Mar-13 6:55am
   
what's story ? what should i do ?
Eugen Podsypalnikov 19-Mar-13 7:02am
   
// what's story ?
A "story" would be the calling sequence including its used parameters :)

// what should i do ?
I would debug the code and then improve it :)
samad_najjar 19-Mar-13 7:22am
   
http://s2.picofile.com/file/7693572361/aaaaa.rar.html
click on "دریافت فایل"
Eugen Podsypalnikov 19-Mar-13 8:25am
   
WOW ! Very nice example ! Thank You :)
I have seen your teapot !!! :)
(just copy the directory "shaders" and the file "wood.ppm" into the EXE-directory)
samad_najjar 19-Mar-13 8:56am
   
i can't undestand what is your solution ???
EXE-directory ??? where
what is "(just copy the directory "shaders" and the file "wood.ppm" into the EXE-directory)"
i can't debug it
Eugen Podsypalnikov 19-Mar-13 9:04am
   
EXE-directory is the directory of "hw0-windows.exe"
I have copied the "shaders" directory and the "wood.ppm" file -
from your project directory int the EXE-directory, then started the "hw0-windows.exe" :)

The debugging (F5 from the VS solution) went just fine,
immediately after unrar and without any exception :)
samad_najjar 19-Mar-13 9:10am
   
can U send me your mail "yahoo"
& chat with me to solve this problem!
i try it but i can't solve
Eugen Podsypalnikov 19-Mar-13 9:55am
   
No, sorry, there is nothing more to chat for me :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900