problem by loading a shader, HELP not resolved

Hi,
My program compile but at the execution it crashes : “the application have to close…”
I don’t find the error, can you help me ?
this is my code :

 class loadShader
{
	private :
		int stringslen[SLEN] ;
		int nbString ;
		const char *strings[SLEN] ;
		
	public :
		loadShader(char *fileName1, char *fileName2) ;
		void loadStrings(char *fileName) ;
};

loadShader::loadShader(char *fileName1, char *fileName2)
{
	unsigned int vsh, fsh ; //vertex shader handler, vertex shader handler

	vsh = glCreateShader(GL_VERTEX_SHADER);
	fsh = glCreateShader(GL_FRAGMENT_SHADER);
	
	loadStrings(fileName) ;
	glShaderSource(vsh, nbString, strings, stringslen);
        strings[0]='\0' ;

	loadStrings(fileName2) ;
	glShaderSource(fsh, nbString, strings, stringslen);

	glCompileShader(vsh);
	glCompileShader(fsh);

	unsigned short int ph = glCreateProgram();//program handler
	glAttachShader(ph, vsh);
	glAttachShader(ph fsh);

	glLinkProgram(ph;
	glUseProgram(ph);
}

void loadShader::loadStrings(char *fileName)
{
	FILE *f ;
	f=fopen(fileName, "r") ;
	nbString=0;
	while(feof(f) !=0 )
	{
		stringslen[nbString]=fscanf(f, "%s", &strings[nbString]);
		nbString++ ;
	}
} 

use a debugger. What IDE/compiler are you using ?

i use visual c++ 6

it seems that it crash at this line :

vsh = glCreateShader(GL_VERTEX_SHADER);

where vsh is an unsigned int.
i don’t understand why…

this is my new code :

 class loadShader
{
	private :
		long int fileLength ;
		char *content  ;

	public :
		loadShader(char *fileName1, char *fileName2) ;
		void loadStrings(char *fileName) ;
};

loadShader::loadShader(char *fileName1, char *fileName2)
{
	fileLength=0 ;
	content=NULL ;
	vsh = glCreateShader(GL_VERTEX_SHADER);
	fsh = glCreateShader(GL_FRAGMENT_SHADER);
	
	loadStrings(fileName1) ;
	const char *cContent = content ;
	glShaderSource(vsh, 1, &cContent, NULL);
	free((void*)content);


	loadStrings(fileName2) ;
	const char *cContent2 = content ;
	glShaderSource(fsh, 1, &cContent2, NULL);
	free((void*)content);

	glCompileShader(vsh);
	glCompileShader(fsh);

	unsigned short int ph = glCreateProgram();//program handler
	glAttachShader(ph, vsh);
	glAttachShader(ph, fsh);

	glLinkProgram(ph);
	glUseProgram(ph);
}

void loadShader::loadStrings(char *fileName)
{
	
	ifstream file ;
	file.open(fileName);
  
	file.seekg(0, ios::end);

	fileLength = file.tellg();
	content = (char *)malloc(sizeof(char) * (fileLength+1));
    
    file.seekg(0, ios::beg);
    file.read(content, fileLength);
	
	content[fileLength] = '\0' ;

    file.close();
} 

does the code update mean you solved the problem…?

i don’t see any declaration of vsh in the new one

Originally posted by carl_lewis:
[b]does the code update mean you solved the problem…?

i don’t see any declaration of vsh in the new one[/b]
in fact it’s the new code with some help, vsh is declared as a global variable

check if your driver supported glCreateShader call (GL_Shading_Language_100)