OpenGLTOP shader program and glGetAttribLocation |cpp

Hi

inside : OpenGLTOP::setupGL() definition
I added

GLint texAttribLocation  = glGetAttribLocation(myProgram.getName(), "cords");

I modify the shader as follow :

static const char *vertexShader = "#version 330\n\ uniform mat4 uModelView; \ in vec3 P; \ in vec2 cords; \ out vec2 uv; \ void main() { \ uv = cords; \ gl_Position = vec4(P, 1) * uModelView; \ }";

static const char *fragmentShader = "#version 330\n\ in vec2 uv; \ out vec4 finalColor; \ void main() { \ finalColor = vec4(uv,0.0,1.0); \ }";

I`m not able to run the shader or make sure that texAttribLocation gets valid value
(its gets -1)
1.there is any tip to debug the shader or getting meaningfull error readings.
I should do the error catcher my self ?
2. there is easier way to edit the shader ?

  1. glGetAttribLocation and program shader…

not sure about the order of operations here and their relationship .

any insight, links and explanations will be great!

Barak

Update :
Now things seem to work finally
I forgot to update the location checker and make sure it checks my attributes and uniforms.

if (vertAttribLocation == -1 || myModelViewUniform == -1 || texAttribLocation == -1) { myError = uniformError; }

Still any additional tips and light on the subject will be great.