Results 1 to 5 of 5

Thread: Metrowerks CodeWarrior Linking

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    2

    Metrowerks CodeWarrior Linking

    Help please! Complete Newbie using the above compiler am unable to link even the most simple app:
    ----------------------------------------
    #include <windows.h>
    #include <freeglut.h>
    using namespace std;
    int main(int argc, char** argv)
    {

    glutInit(&argc, argv);
    }
    ---------------------------
    Error given is:
    Link error: Undefined symbol: __imp__glutInit@8
    ---------------------------
    Am I using the wrong library? Also, I had to alter the embedded include directives from

    #include "GL\gl.h" to #include "gl.h"

    in order to get anywhere....

    Any suggestions much appreciated!

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    Re: Metrowerks CodeWarrior Linking

    dunno about the pc, but if on mac make sure you have all the necesarry stubs and resource files in your project.

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Metrowerks CodeWarrior Linking

    I don't know why, but a lot of people in the C++ class I had to take at school had the same misconception you seem to have.

    Doing this..

    #include <glut.h>

    Is not adding the library.

    .h files are what are called header files, not libraries. That means that they contain prototypes for functions, etc. They do not contain the object code for those functions. That object code is what is contained in the actual library. The actual library has an extension like .lib or .a or .so etc. depending on the compiler.

    To add a library, you need to tell the linker which library to link in to the final binary. I'm not sure exactly how this is done with CodeWarrior, but somone else may be able to tell you how. You should look for some project setting that lets you specify libraries/object modules, etc.

    Hope this helps.
    Deiussum
    Software Engineer and OpenGL enthusiast

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    Re: Metrowerks CodeWarrior Linking

    In codewarrior you just drag them to the project window. i.e. if on mac add the GLLibraryStub etc.
    glut.lib
    glut.rsrc

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    2

    Re: Metrowerks CodeWarrior Linking

    that's great - thanks guys, problem sorted!

Similar Threads

  1. OpenGl+CodeWarrior
    By Andrewinator in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 10-22-2003, 03:09 PM
  2. OpenGL in Metrowerks CodeWarrior
    By amiller in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-11-2002, 04:42 AM
  3. Metrowerks Codewarrior
    By ChrisS in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-06-2001, 06:25 AM
  4. OpenGL Panes @ Metrowerks updated
    By adriaant in forum OpenGL: macOS
    Replies: 0
    Last Post: 02-13-2001, 06:54 PM
  5. Metrowerks Codewarrior and GLUT
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 10-21-2000, 07:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean