Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy won't this GLUT program compile? Am I missing libraries or headers?
    text
    copied!<p>I've just started using Linux (Mint 11), and recently, I decided to take up OpenGL programming as a hobby. I'm finding the code and techniques relatively simple enough, however, I'm having a hard time trying to get all the resources in the right place. The code is: </p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;GL/glew.h&gt; #ifdef __APPLE__ # include &lt;GLUT/glut.h&gt; #else # include &lt;GL/glut.h&gt; #endif static int make_resources(void) { return 1; } static void update_fade_factor(void) { } static void render(void) { glClearColor(1.0f, 1.0f, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glutSwapBuffers(); } int main(int argc, char** argv) { glutInit(&amp;argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); glutInitWindowSize(400, 300); glutCreateWindow("Hello World"); glutDisplayFunc(&amp;render); glutIdleFunc(&amp;update_fade_factor); glewInit(); if (!GLEW_VERSION_2_0) { fprintf(stderr, "OpenGL 2.0 not available\n"); return 1; } if (!make_resources()) { fprintf(stderr, "Failed to load resources\n"); return 1; } glutMainLoop(); return 0; } </code></pre> <p>When I compile, I get the following messages</p> <pre><code>../../Libraries/glut-3.7/lib/glut/libglut.so||undefined reference to `glXQueryChannelRectSGIX'| ../../Libraries/glut-3.7/lib/glut/libglut.so||undefined reference to `glXChannelRectSyncSGIX'| ../../Libraries/glut-3.7/lib/glut/libglut.so||undefined reference to `glXChannelRectSGIX'| ../../Libraries/glut-3.7/lib/glut/libglut.so||undefined reference to `glXQueryChannelDeltasSGIX'| ../../Libraries/glut-3.7/lib/glut/libglut.so||undefined reference to `glXBindChannelToWindowSGIX'| ||=== Build finished: 5 errors, 0 warnings ===| </code></pre> <p>Looking online told me that I'm probably not including the right libraries (presumably libX), however I'm unsure of where I can find them, If they're even the right ones to use. I've already tried linking /usr/lib/X86_64-linux-gnu/libX11.so, /usr/lib/X11 contains neither library files nor a /lib directory, and I'm certain that the lib11-dev package is installed. What am I doing wrong? </p> <p><strong>INFO:</strong><br> OS: Linux Mint 11<br> IDE: Code::blocks 10.05<br> Following <a href="http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-2%3a-Hello-World%3a-The-Slideshow.html" rel="nofollow">this</a> tutorial. <em>Note: I cannot find the x11r6 directories it refers to.</em></p>
 

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