Cant compile and/or run cpp program.
<p>Hello I'm new to cpp and am trying to compile my first OpenGL code, but having some problems.
I'l try to give as much info as I can.</p>

<p>Here is my source code <a href="http://pastebin.com/w76X43KP" rel="nofollow">http://pastebin.com/w76X43KP</a>
<code></code></p>

<p>When I try to compile with "make file" <a href="http://pastebin.com/wD6LUWrb" rel="nofollow">http://pastebin.com/wD6LUWrb</a>
It seems to compile ok, but when I run the application I get this error:</p>

<pre><code>    X Error of failed request:  BadRequest (invalid request code or no such operation)
    Major opcode of failed request:  136 (GLX)
    Minor opcode of failed request:  19 (X_GLXQueryServerString)
    Serial number of failed request:  12
    Current serial number in output stream:  12
</code></pre>

<p>When I try to compile in command line with :</p>

<pre><code>     g++ -lglut -lGL -lGLU -lGLEW src/cppOpenGL2.cpp -o example2
</code></pre>

<p>I get these errors:</p>

<pre><code>    /tmp/ccmtDSv9.o: In function `DrawAQuad()':
    cppOpenGL2.cpp:(.text+0x2a): undefined reference to `glClearColor'
    cppOpenGL2.cpp:(.text+0x36): undefined reference to `glClear'
    cppOpenGL2.cpp:(.text+0x42): undefined reference to `glMatrixMode'
    cppOpenGL2.cpp:(.text+0x47): undefined reference to `glLoadIdentity'
    cppOpenGL2.cpp:(.text+0x77): undefined reference to `glOrtho'
    cppOpenGL2.cpp:(.text+0x83): undefined reference to `glMatrixMode'
    cppOpenGL2.cpp:(.text+0x88): undefined reference to `glLoadIdentity'
    cppOpenGL2.cpp:(.text+0xc6): undefined reference to `gluLookAt'
    cppOpenGL2.cpp:(.text+0xd2): undefined reference to `glBegin'
    cppOpenGL2.cpp:(.text+0xf1): undefined reference to `glColor3f'
    cppOpenGL2.cpp:(.text+0x110): undefined reference to `glVertex3f'
    cppOpenGL2.cpp:(.text+0x12f): undefined reference to `glColor3f'
    cppOpenGL2.cpp:(.text+0x14e): undefined reference to `glVertex3f'
    cppOpenGL2.cpp:(.text+0x16d): undefined reference to `glColor3f'
    cppOpenGL2.cpp:(.text+0x18c): undefined reference to `glVertex3f'
    cppOpenGL2.cpp:(.text+0x1ab): undefined reference to `glColor3f'
    cppOpenGL2.cpp:(.text+0x1ca): undefined reference to `glVertex3f'
    cppOpenGL2.cpp:(.text+0x1cf): undefined reference to `glEnd'
    /tmp/ccmtDSv9.o: In function `main':
    cppOpenGL2.cpp:(.text+0x1e7): undefined reference to `XOpenDisplay'
    cppOpenGL2.cpp:(.text+0x256): undefined reference to `glXChooseVisual'
    cppOpenGL2.cpp:(.text+0x2be): undefined reference to `XCreateColormap'
    cppOpenGL2.cpp:(.text+0x345): undefined reference to `XCreateWindow'
    cppOpenGL2.cpp:(.text+0x361): undefined reference to `XMapWindow'
    cppOpenGL2.cpp:(.text+0x380): undefined reference to `XStoreName'
    cppOpenGL2.cpp:(.text+0x3a7): undefined reference to `glXCreateContext'
    cppOpenGL2.cpp:(.text+0x3cd): undefined reference to `glXMakeCurrent'
    cppOpenGL2.cpp:(.text+0x3d9): undefined reference to `glEnable'
    cppOpenGL2.cpp:(.text+0x3f1): undefined reference to `XNextEvent'
    cppOpenGL2.cpp:(.text+0x41a): undefined reference to `XGetWindowAttributes'
    cppOpenGL2.cpp:(.text+0x441): undefined reference to `glViewport'
    cppOpenGL2.cpp:(.text+0x45d): undefined reference to `glXSwapBuffers'
    cppOpenGL2.cpp:(.text+0x48d): undefined reference to `glXMakeCurrent'
    cppOpenGL2.cpp:(.text+0x4a4): undefined reference to `glXDestroyContext'
    cppOpenGL2.cpp:(.text+0x4bb): undefined reference to `XDestroyWindow'
    cppOpenGL2.cpp:(.text+0x4c8): undefined reference to `XCloseDisplay'
    collect2: ld returned 1 exit status
</code></pre>

<p>My OS is Ubuntu 12</p>
