Note that there are some explanatory texts on larger screens.

plurals
  1. POCompiling and runnin OpenGL (glut) program in ubuntu 10.10
    primarykey
    data
    text
    <p>I wrote this code:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;GL/glx.h&gt; #include &lt;GL/gl.h&gt; #include &lt;GL/glut.h&gt; void init() { glClearColor(1.0,1.0,1.0,0.0); glMatrixMode(GL_PROJECTION); gluOrtho2D(0.0,200.0,0.0,150.0); } void lineSegment() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.0,0.0,1.0); glBegin(GL_TRIANGLES); glVertex2i(40,120); glVertex2i(40,20); glVertex2i(80,20); glEnd(); glFlush(); } int main() { glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB); glutInitWindowPosition(50,100); glutInitWindowSize(400,300); glutCreateWindow("An Example OpenGL...."); init(); glutDisplayFunc(lineSegment); glutMainLoop(); return 0; } </code></pre> <p>and this is my error.</p> <pre><code>funfullson@funfullson:~$ gcc gl.cpp /tmp/cchfRGT2.o: In function `init()': gl.cpp:(.text+0x2a): undefined reference to `glClearColor' gl.cpp:(.text+0x36): undefined reference to `glMatrixMode' gl.cpp:(.text+0x5a): undefined reference to `gluOrtho2D' /tmp/cchfRGT2.o: In function `lineSegment()': gl.cpp:(.text+0x6e): undefined reference to `glClear' gl.cpp:(.text+0x8d): undefined reference to `glColor3f' gl.cpp:(.text+0x99): undefined reference to `glBegin' gl.cpp:(.text+0xad): undefined reference to `glVertex2i' gl.cpp:(.text+0xc1): undefined reference to `glVertex2i' gl.cpp:(.text+0xd5): undefined reference to `glVertex2i' gl.cpp:(.text+0xda): undefined reference to `glEnd' gl.cpp:(.text+0xdf): undefined reference to `glFlush' /tmp/cchfRGT2.o: In function `main': gl.cpp:(.text+0xf6): undefined reference to `glutInitDisplayMode' gl.cpp:(.text+0x10a): undefined reference to `glutInitWindowPosition' gl.cpp:(.text+0x11e): undefined reference to `glutInitWindowSize' gl.cpp:(.text+0x12a): undefined reference to `glutCreateWindow' gl.cpp:(.text+0x13b): undefined reference to `glutDisplayFunc' gl.cpp:(.text+0x140): undefined reference to `glutMainLoop' /tmp/cchfRGT2.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status </code></pre> <p>I dont know what I have to do.please learn me how to do it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload