GLSL glShaderSource syntax

I wrote a GLSL shader a while back, and I accidentally wrote in a syntax error. But when I got the error log, I noticed something - all the errors it gave were reported as being on line 1. The way I linked my shader source was by generating an array of strings, with the lines in order in the array. Is this the way this is supposed to work, or is the array supposed to be length one with \n at the end of each line? If so, why is it an array, rather than a single String?

There is no direct link between the array indices and line numbers. The compiler simply concatenates all the elements. If you want correct line numbers you’ll have to insert newline characters.

[quote=""]