I have trouble installing external libraries

This is a discussion on I have trouble installing external libraries within the C++ Programming forums, part of the General Programming Boards category; I've been wanting to use OpenGl or such programs for a while but whenever I try to install any external ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    106

    I have trouble installing external libraries

    I've been wanting to use OpenGl or such programs for a while but whenever I try to install any external library some how I don't do something right and it never works. I know you should copy and paste the correct things into the include and bin directories so I do that then put the correct linkers in the linker settings but I never seem to get it right(I use code::blocks)

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    106
    Okay so I followed a tutorial to get this code to try glut...

    Code:
    #include<gl\glut.h>//This header file contains all the commands for the OpenGL Utility Toolkit
    
    //function to initialize GLUT settings
    void init()
    {
        glClearColor(0,0,0,0);//(NEW) we define the background color here
    }
    
    
    //The function where all the drawing occurs
    void display()
    {
        glClear(GL_COLOR_BUFFER_BIT);//Clear the screen
    
    
        glFlush();//Draw everything to the screen
        glutPostRedisplay();//Tell the program to refresh
    }
    
    
    int main(int argc, char** argv)
    {
        glutInit(&argc, argv);//initialize GLUT.
        glutInitWindowSize(800,600);//define the window size as 800 pixels wide and 600 pixels high    glutInitWindowPosition(10,50);//Set the window position at (10,50)
        glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);//Set the initial display mode
        glutCreateWindow("Lesson 1");//Create our window
        init();//call init()
        glutDisplayFunc(display);//tell GLUT what our display function is
        glutMainLoop();//Tell the program we are not done yet
    }
    but i get these errors.. what am i doing wrong?

    Code:
    obj\Debug\main.o||In function `glutInit_ATEXIT_HACK':|
    C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\gl\glut.h|483|undefined reference to `___glutInitWithExit@12'|
    obj\Debug\main.o||In function `glutCreateWindow_ATEXIT_HACK':|
    C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\gl\glut.h|500|undefined reference to `___glutCreateWindowWithExit@8'|
    obj\Debug\main.o||In function `glutCreateMenu_ATEXIT_HACK':|
    C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\gl\glut.h|546|undefined reference to `___glutCreateMenuWithExit@8'|
    ||=== Build finished: 3 errors, 0 warnings ===|

  3. #3
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,648
    You're not linking the lib file. You need to add the OpenGL libs to the list of libraries with which to link. See the Code:Blocks FAQ

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    106
    Okay so all I have to do is add in what to link where i have the .h and .a file in the include and lib folders of the compiler.. correct? Then I go to link libraries under linker settings, and there I have the following libraries... opengl32, glu32, glut32

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testpad for itoa()
    By frktons in forum C Programming
    Replies: 92
    Last Post: 07-19-2010, 03:05 PM
  2. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  5. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 02:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21