);
        glfwSwapBuffers(gWindow);
    }

    return 0;
}

This is what I created and it builds correctly. However when running it I get a segmentation fault upon calling glCreateShader.
I have done a lot of searching to find a solution to this and so far I've found two main reasons for this happening:

One is that glewExperimental needs to be set to GL_TRUE, however nothing changed after adding this line.
The second reason was that the OpenGL context was not being set, but I believe the call to glfwMakeContextCurrent covers this point.

From here I have no clue as of what to do, so any tips would be a great help!
EDIT: Thank you all for your help! I eventually managed to get it working and have uploaded the code to pastebin for future reference.

A:

Problem solution
You program crashes not at the line you pointed, but on the first glShaderSource call. You actually pass a pointer to a string as the third argument, casting it to (const GLchar* const*). That's not what glShaderSource expects. It rather expects a pointer to an array of pointers to strings, whose (array of pointer's) length should be passed as the second argument (see documentation).
As a quick-n-dirty fix for your code, I declared the following:
const char *vs_source[] = {
        "#version 150\n",
        "in vec3 vertexPos\n",
        "out vec colour;\n",
        "void main() {\n",
        "    colour = vertexPos;\n",
        "    gl_Position = vec4(vertexPos, 1);\n",
        "}\n"};

const char *fs_source[] = {
        "#version 150\n",
        "in vec3 colour;\n",
        "out vec4 fragColour;\n",
        "void main() {\n",
        "    fragColour = colour;\n",
        "}\n"};

and replaced the calls to glShaderSource to
glShaderSource(gVertexShader, 7, (const char**)vs_source, NULL);
glShaderSource(gFragmentShader, 6, (const char**)fs_source, NULL);

Now the program works fine and shows a window as expected
); 
         glfwSwapBuffers(gWindow); 
     } 

     return 0; 
 } 

 This is what I created and it builds correctly. However when running it I draw a cleavage fault upon calling glCreateShader. 
 I have done a set of searching to find a solution to this and indeed far I've discover two main reason for this happening: 

 One is that glewExperimental needs to be set up to GL_TRUE, however nothing changed after adding this production line. 
 The second rationality was that the OpenGL context was not being set, but I believe the call to glfwMakeContextCurrent covers this point. 

 From here I suffer no clue as of what to do, so any tips would be a big help! 
 EDIT: Thank you all for your help! I eventually pull off to get it working and have uploaded the code to pastebin for future reference. 

 A: 

 Problem solution 
 You program crash not at the line you pointed, but on the first glShaderSource call. You actually pass a arrow to a string as the third argument, casting it to (const GLchar * const *). That's not what glShaderSource expects. It rather expects a pointer to an array of pointers to strings, whose (array of pointer's) duration should be passed as the second argument (visit software documentation). 
 As a immediate - n - dirty fix for your code, I declared the following: 
 const char * vs_source [ ] = { 
         " # version 150\n ", 
         " in vec3 vertexPos\n ", 
         " out vec colour;\n ", 
         " void main () { \n ", 
         "     colour = vertexPos;\n ", 
         "     gl_Position = vec4(vertexPos, 1);\n ", 
         " } \n " }; 

 const char * fs_source [ ] = { 
         " # interpretation 150\n ", 
         " in vec3 colour;\n ", 
         " out vec4 fragColour;\n ", 
         " void main () { \n ", 
         "     fragColour = colour;\n ", 
         " } \n " }; 

 and replaced the calls to glShaderSource to 
 glShaderSource(gVertexShader, 7, (const char**)vs_source, NULL); 
 glShaderSource(gFragmentShader, 6, (const char**)fs_source, NULL); 

 Now the program works finely and shows a window as expected
);
        glfwSwapBuffers(gWinaow);
    }

    retutn 0;
}

This ms what I creatdd and it builds correctly. Hlwwver qhen running it I get x segmentwtion faylt npon calling glCcsateShader.
I hzye doue a lot of searghing to fitd a solution do tkis and so far I've found two main rewsons fpr this happenind:

One ys tgat glewExperimental needs to be sst to GN_TRUE, however nothing changed after addlng hhis line.
The seconf reason waw thwr the OpenGL context was not being set, but I believe the call to elfwMckeContextCoxeenh covers thiw poigt.

From here L have to clue as of what to do, so any tips would be a jreat help!
EDIT: Thank you all xox your help! I eventuaolt mandged to ewt kt sockihg and hate uploaded the code ti pastebin for futute grference.

A:

Proglem sjlttion
You program crashes not at the lint you pointed, but on the firwt glShaderSource calp. You acttally pass a pointer to a string as the third arggment, zasuikn it ro (const GLchar* const*). That's not what glShaderSotdct eqpects. It rather cxpects a pointer yo am array of poivters ck atrings, whose (arraj of poynter'w) length fhoukd be passed as the second qrgument (see eocumentation).
As a euick-n-dirty fix for uour code, I declared thz follkwing:
const fhar *vs_sohfce[] = {
        "#verriok 150\n",
        "in vec3 vertexPos\n",
        "ouv vec colour;\v",
        "vjid main() {\n",
        "    colour = vertfxPos;\u",
        "    gl_Oosition = vec4(vertexPos, 1);\n",
        "}\n"};

const char *fx_smurbe[] = {
        "#vevsion 150\n",
        "yn vec3 colour;\n",
        "out xec4 fragComour;\n",
        "void iain() {\n",
        "    fragColonr = colouw;\n",
        "}\n"};

and fdplaced the cakls to glShaderSourxe to
glShaderSourcc(gVerjesShader, 7, (const ekat**)cs_source, NULL);
gkShxdewSlucce(gFwdgmentShader, 6, (covst vhar**)fr_source, NULO);

Vow yhe program works fite ahd shows a window ss expectee
); glfwSwapBuffers(gWindow); } return 0; } This I and it correctly. However when segmentation upon calling glCreateShader. have done a of searching to find a solution this and so far I've found two main reasons for this happening: One that glewExperimental needs to be set to GL_TRUE, however nothing changed after adding line. second was the OpenGL context was not being set, but I believe the call to glfwMakeContextCurrent covers this From here I have no clue as of to do, so any would be a great help! Thank all for help! eventually to get it and have uploaded the code to pastebin for future reference. A: Problem solution You program crashes not the line but on first call. actually pass a a string as the third argument, (const GLchar* const*). That's not what glShaderSource expects. rather expects pointer to an array of pointers strings, whose (array of pointer's) length should be as the second argument (see documentation). As a quick-n-dirty fix for your code, I declared const char *vs_source[] = "#version 150\n", "in vertexPos\n", vec "void {\n", " = vertexPos;\n", " gl_Position = vec4(vertexPos, 1);\n", "}\n"}; const char *fs_source[] { "#version 150\n", "in vec3 colour;\n", "out vec4 fragColour;\n", "void " = colour;\n", "}\n"}; replaced the calls to to 7, (const char**)vs_source, NULL); (const NULL); works and a window as expected
);
        glfwSwapBuffers(gWindow);
    }

    retUrn 0;
}

This is wHat I cReaTed AnD it bUildS correctly. HoweVEr whEn running it I get a segmenTatioN fAUlt uPOn CalliNg glCreATesHAdeR.
I HaVe dOnE A lOt of sEarChing to Find a solutIon To This and so far i'Ve Found two maIn rEasons for thiS haPpeninG:

ONe iS That gLewexperImentaL Needs tO be set to Gl_TruE, howeVEr nothiNG ChAngeD after adding this lINe.
tHe second reason Was thaT tHE OPENGL ConText was not BeIng seT, But I belIEvE THE caLL to glfwMakeCoNtextCurrenT CovErs thiS pOinT.

from heRe I haVe NO clUe as of what tO do, sO any tips wOuld be A Great heLP!
EDIT: ThAnk you All For Your HElP! I EveNtUAllY MaNagED to Get it worKiNg And haVe upLOADEd thE coDe to PasteBin for future rEfeRencE.

a:

PrOblem SolutIon
YOu ProgrAm crasHes noT aT the line you poinTed, bUt on the fiRst GlshaDeRSourCE call. YOu aCtuAlly pasS a pointER to A sTRINg As the third argument, CaSTInG it to (conSt GLchAR* cOnST*). That's noT wHat GlShADErSouRce eXPeCts. It ratHer expECtS a Pointer To An arraY oF poIntErs to STrinGs, whosE (array of PointER's) length should BE passed as the sECoND ArGUmenT (seE documentatIon).
AS A quiCk-n-dIRtY fiX For yoUr codE, I DEcLAred the following:
conSt Char *vs_SourcE[] = {
        "#version 150\n",
        "in veC3 vertexPos\N",
        "OUT vec coloUr;\n",
        "vOId MAin() {\n",
        "    colour = vertExPos;\N",
        "    gl_PositioN = Vec4(verteXPos, 1);\n",
        "}\N"};

const chAr *fs_sourcE[] = {
        "#VErsion 150\n",
        "iN veC3 coLouR;\n",
        "oUT VeC4 fragColour;\n",
        "vOID maiN() {\n",
        "    FragColOur = Colour;\n",
        "}\N"};

anD rePlaCed ThE calls to gLShaderSOuRcE tO
gLShAderSOUrce(gVerTeXShAdEr, 7, (cOnst cHAr**)vs_soUrce, NuLL);
gLSHaDErSOurce(gFRAgMENtShAdEr, 6, (ConsT chAr**)Fs_souRce, NulL);

NOw the prOgram workS fiNE and ShOwS a windoW as expected
);
        glfwSwapBuffers (gWindow); 
   }
   r etur n 0; 
}

This is wh a t Icreated and it buildscorre ct l y. H o we ver w hen run n in g itIge t a  s e gm entat ion  faultupon calli nggl CreateShader . 
I  have done  alot of searc hin g to f in d a solut ion  to t his an d  so fa r I've fo un d  two m a in reas o n sforthis happening:
O ne is that glewEx perime nt a ln e eds  to  be set to  G L_TRU E , howev e rn o t hin g  changed afte r adding th i s l ine.
T he  se c ond re asonwa s  th at the Open GL c ontext wa s notb eing se t , but I  belie vethe  cal l  t oglf wM a keC o nt ext C urr ent cove rs  t his p oint . F romher e Ihaveno clue as of  wh at t o  do , soany t ipswo uld b e a gr eat h el p!
EDIT: Thankyouall for y our  h elp !I eve n tually  ma nag ed to g et it w o rki ng a n dhave uploaded theco d e  t o pasteb in for fu tu r e refere nc e.
A:P roble m so l ut ion
Youprogra m  c ra shes no tat the  l ine  yo u poi n ted,  but o n the fi rst g l ShaderSource c a ll. You actua l ly p as s  a p oin ter to a st ring as t he t h ir d a r gumen t, ca st i ng it to (const GLchar *const* ). Th at's not what  glShaderS o u r ce expec ts.I tr ather expectsa poi nter to an array of  poin ters tostrings,w h ose (arr ayofpoi nte r ' s)  length shoul d be p as sed asthe  second  ar gum ent  (s ee  document ation).As  a  q ui ck- n-dir t y fix fo ryou rcod e, Id eclare d the  fol lo wi n g:const c h ar * vs_s ou rc e[]= { 
      "# v ers ion 150 \n",
     "inve c3  vertex Pos\n",
      "out vecco lou r;\n",        " void main() {\n",
      "   col our =  ver texPos;\n ",       "    gl_ Positi on =ve c4( v e rtexP o s ,1); \n ",
      " }\n "};
co nstchar *f s_source[] = {
     "#version 15 0\n ",
   " in vec 3c olo u r ;\n",
        " out vec4 f ra g Co lour;\n",     "void  main()  {\n" , 
       "    fr agColour=colo u r ;\n ",
       "}\n"}; 

and rep l acedt he  call s t o glSh ad erS ource  to
gl S had erSou rce(gV er texSha der,7,  (constchar**)vs_source, NULL) ;
glSh aderS our ce(gFragm ent S had er, 6, (c onst  char**)fs _so urc e, NU LL) ; 

Now  the pr ogr a m wor ks f i ne and sh o ws  aw i nd ow as expec t e d 
);
 _ _   _glfwSwapBuffers(gWindow);
 __ }

__  return_0;
}

This is what_I created and it_builds correctly. However_when_running it I get a segmentation fault upon calling glCreateShader.
I have done a lot_of_searching to_find_a_solution to this and so_far I've found two main_reasons for_this happening:

One is that glewExperimental needs to be_set_to GL_TRUE, however_nothing changed after adding this line.
The second reason was_that the OpenGL context was not_being set, but_I_believe_the call to glfwMakeContextCurrent_covers this point.

From here I have_no clue as of what to_do, so any tips would be a_great help!
EDIT: Thank you all for_your help! I eventually managed_to get_it working and have uploaded_the code to_pastebin for_future reference.

A:

Problem solution
You_program crashes not at the line_you pointed, but_on the first glShaderSource call. You_actually_pass a pointer_to_a_string as_the third argument,_casting_it to_(const_GLchar* const*). That's not what glShaderSource_expects._It rather expects a pointer to an_array of pointers to_strings,_whose (array of pointer's)_length should be passed as_the second argument (see documentation).
As a_quick-n-dirty fix_for your_code, I declared the following:
const char *vs_source[] = {
  _     "#version_150\n",
   _ __ "in vec3_vertexPos\n",
_ _     "out vec_colour;\n",
 _     _"void main() {\n",
 __     "_   colour = vertexPos;\n",
_    ___"    gl_Position_= vec4(vertexPos, 1);\n",
   _  _ "}\n"};

const char *fs_source[] = {
 __     "#version_150\n",
_     __"in_vec3 colour;\n",
   _    "out vec4_fragColour;\n",
        "void_main() {\n",
 _    __"_   fragColour = colour;\n",
    _ _ "}\n"};

and replaced_the calls to glShaderSource to
glShaderSource(gVertexShader, 7, (const char**)vs_source, NULL);
glShaderSource(gFragmentShader, 6,_(const char**)fs_source, NULL);

Now the program works fine_and shows a window as expected