<p>The error message gives a clue in the wording:</p>

<pre><code>#version must occur before any other program statement
</code></pre>

<p>Is there a reason that the previous 2 lines need to appear before the <code>#version</code> line? If not, you can avoid the error by moving this line to the beginning, since the actions of the lines are independent of their order in this instance.</p>

<p>The <code>#version</code> needing to be at the beginning of the file is not a new requirement. I don't know why you were able to run this code previously.</p>

CC BY-SA 3.0
2016-05-29T20:56:59.567Z
Yet as you can see by yourself Chapman's unedited algorithm is given in this exact form, and I do guarantee that it could run perfectly on this but also another computer (both having ATI graphics cards). I think it could have something to do with Vulkan and a more strict set of rules, but I have not been able to verify it yet.
ealione
CC BY-SA 3.0
2016-05-29T22:10:04.893Z
@green_leaf oh yes I'm not doubting that it did work - I just don't have an explanation for why. I guess the change was a "correction" even though it hasn't turned out to be helpful for you...
trichoplax is on Codidact now
CC BY-SA 3.0
2016-05-30T01:04:12.653Z
that's very classic with ATI
v.oddou
CC BY-SA 3.0
2016-05-30T18:19:32.347Z
@v.oddou indeed now that you mention it. It seems that they do that quite often.
ealione
CC BY-SA 3.0
2016-05-29T16:33:58.057Z
2016-05-29T16:33:58.057Z
trichoplax is on Codidact now
<p>After updating my graphics driver and trying to run <a href="http://john-chapman-graphics.blogspot.al/2013/02/pseudo-lens-flare.html">this</a> example from John Chapman's blog I got this error</p>

<pre><code>Vertex shader failed to compile with the following errors:
ERROR: 0:8: error(#105) #version must occur before any other program statement
</code></pre>

<p>The way that the version is defined is by including a file containing this code</p>

<pre><code>#ifndef DEF_GLSL_
#define DEF_GLSL_

#version 420

...
</code></pre>

<p>So inside all other shader files one can see that the first line is as follows</p>

<pre><code>#include "common/def.glsl"
...
</code></pre>

<p>I remember this working perfectly a few months ago. So what exactly has changed and the <code>#include</code> command is no longer valid?</p>

CC BY-SA 3.0
2016-05-29T14:26:59.780Z
There are a lot of code snippets on the linked page, but none of them appear to have the character "`#`". Could you show a minimal example of code that you know gives this error message?
trichoplax is on Codidact now
CC BY-SA 3.0
2016-05-29T14:50:16.080Z
@trichoplax my bad. I should have explained that there is an executable provided in order for you to run it. I will update the question with a minimal example.
ealione
<opengl><glsl>
Why cant I use `#include` after upgrading my driver
ealione
# Why cant I use `#include` after upgrading my driver

(Asked by: username_0 on 2016-05-29)

After updating my graphics driver and trying to run [this](http://john-chapman-graphics.blogspot.al/2013/02/pseudo-lens-flare.html) example from John Chapman's blog I got this error

```
Vertex shader failed to compile with the following errors:
ERROR: 0:8: error(#105) #version must occur before any other program statement

```

The way that the version is defined is by including a file containing this code

```
#ifndef DEF_GLSL_
#define DEF_GLSL_

#version 420

...

```

So inside all other shader files one can see that the first line is as follows

```
#include "common/def.glsl"
...

```

I remember this working perfectly a few months ago. So what exactly has changed and the `#include` command is no longer valid?

**Tags:** opengl, glsl

> **Comments:**
> **username_1**: There are a lot of code snippets on the linked page, but none of them appear to have the character "`#`". Could you show a minimal example of code that you know gives this error message?  
> **username_0**: @username_1 my bad. I should have explained that there is an executable provided in order for you to run it. I will update the question with a minimal example.  

---

## 1 answers

### Answer by username_1 on 2016-05-29. Score: 4

The error message gives a clue in the wording:

```
#version must occur before any other program statement

```

Is there a reason that the previous 2 lines need to appear before the `#version` line? If not, you can avoid the error by moving this line to the beginning, since the actions of the lines are independent of their order in this instance.

The `#version` needing to be at the beginning of the file is not a new requirement. I don't know why you were able to run this code previously.

> **Comments:**
> **username_0**: Yet as you can see by yourself Chapman's unedited algorithm is given in this exact form, and I do guarantee that it could run perfectly on this but also another computer (both having ATI graphics cards). I think it could have something to do with Vulkan and a more strict set of rules, but I have not been able to verify it yet.  
> **username_1**: @green_leaf oh yes I'm not doubting that it did work - I just don't have an explanation for why. I guess the change was a "correction" even though it hasn't turned out to be helpful for you...  
> **username_2**: that's very classic with ATI  
> **username_0**: @username_2 indeed now that you mention it. It seems that they do that quite often.  

---

