GLSL and nvidia 91.31 driver


I just updated my driver from 84.21 to 91.31 and when my application tries to compile a vertex shader (code below) I receive the errors:
<7> C0000 syntax error: unexpected $undefined at token “<undefined>”
<7> C0501 error: …

the vertex shader is simply:

void main()
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = ftransform();

line 7 is the last line with the curly brace on it, this code works fine with driver 84.21. Did the compiler change between these two drivers or something. Any help would be appreciated. Until then though I can just use the older driver.

Just a wild guess, try to add or remove spaces/CR/LF chars at the end.

How do you read the file? Make sure you have no empty string at the end of the file.

I once had the same problem. My loading code uses fgets, and this reads until the next
or EOF. This means with a properly formatted text file, it reads the last line, and on the next call it immediately reads the EOF. I didn’t catch this at first, and this resulted in exactly this error message.

I have not had this problem with my graphics card since I updated the drivers. I am using a Geforce 6800gts.

What graphics card do you have?

I agree with the above people, it is probably your loading code.

Can you post the code you use to read in the file and send it to OpenGL?


thanks for the help. here is the code that i use to load the shaders.

char *read_text_file(const char* file)
    if(!file) return NULL;

    FILE *f = fopen(file ,"r");
    if(!f) return NULL;

    fseek(f, 0, SEEK_END);
    int sz = ftell(f);
    fseek(f, 0, SEEK_SET);

    char *retv = (char*)malloc(sz+1);
    fread(retv, sz, 1, f);
    retv[sz] = 0;

    return retv;

i'm going to try doing this differently and seeing what happens.

retv[sz>0 ? sz-1:sz] = 0;


I tried a completely different method for loading the text and now the program works with the new drivers.

I also tried your fix and that did not work unfortunately.

Thank you for the help.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.