-3

I'm working on writing code for simpliest shader. Here is its code.

const char* Vertex_Shader_Descrip = "#version 330/n"

"layout(location = 0) in vec3 position;/n"

"void main()/n"
"{/n"
"gl_Position = vec4(position.x, position.y, position.z, 1.0);/n"
"}/0";

glsl shader compilation fails with the error

error C0206: invalid token "<invalid atom 199709744>" in version line

Don't remember the exact version of shader, but it supports opengl 3.3

Please, could you point on my mistakes if there's any or just explain me what is wrong?

acraig5075
  • 10,588
  • 3
  • 31
  • 50
  • 6
    `/n`? Shouldn't that be `\n`? – Blaze Sep 09 '19 at 12:31
  • 1
    It seems you could need to spend some time to refresh basic C++ knowledge. The compiler will automatically add the null-terminator to all string literals, you don't need to add it yourself (it will just waste a character). And the wrong "newlines" is an indicator as well that you need to refresh your knowledge. – Some programmer dude Sep 09 '19 at 12:36

2 Answers2

1

You need to use reverse slash instead of used.

const char* Vertex_Shader_Descrip = "#version 330\n"
TroubleSet
  • 79
  • 8
0

Remove all the /n and try adding \n.

Arjun V
  • 197
  • 4
  • 16