# GLSL: define a constant for both vertex and fragment shader

I have a constant for defining an array in the vertex shader. I want to use this constant also in the fragment shader to define another array of the same size. Naive attempts fail (simply use the constant of the vertex shader in the fragment shader or using a #define from the vertex shader). Is this somehow possible?

The only idea I can come up with is using something like an include statement, which seems to be added (source), but I didn't yet find the time to implement this.

There is a reason why glShaderSource and glCompileShaderProgram both take an array of strings. It's so that you can effectively insert code before your actual shader text or otherwise implement your own "include" system.
I assume most developers implement some kind of include system - whether it's by using the ARB_shading_language_include extension, or by passing shader source files through the C preprocessor before compiling them, or some other method.