linking an opengl program

This is a discussion on linking an opengl program within the C++ Programming forums, part of the General Programming Boards category; hello i have problem with linking my program. it compiles well but when i try to link it i get ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    12

    linking an opengl program

    hello

    i have problem with linking my program.
    it compiles well but when i try to link it i get following errors:

    unresolved external auxInitDisplayMode referenced from c:\firstgl.cpp

    unresolved external auxInitPosition referenced from c:\firstgl.cpp

    unresolved external auxInitWindowA referenced from c:\firstgl.cpp

    and source:

    Code:
    #include <windows.h>   // Standard Window header required for all programs
    #include <conio.h>     // Console I/O functions
     #include <gl/glaux.h>   //AUX Library functions
    #include <gl/gl.h> // OpenGL functions
    
    void main(void)
            {
            // These are the AUX functions to set up the window
            auxInitDisplayMode(AUX_SINGLE | AUX_RGBA);
            auxInitPosition(100,100,250,250);
            auxInitWindow("My first OpenGL Program");
    
            // These are the OpenGL functions that do something in the window
            glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
            glClear(GL_COLOR_BUFFER_BIT);
    
            glFlush();
    
            // Stop and wait for a keypress
            cprintf("Press any key to close the Window\n");
            getch();
            }
    im using borland 5.5
    Attached Files Attached Files

  2. #2
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    I do not really know anything about OpenGL but I thought that sort of stuff had to be done through a windows program?

    Disregard this post if im off my scone.

    ~ Paul

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    well, when i try to compile and link with that command:

    c:\bcc32 -W firstgl.cpp

    i get this error:
    unresolved external 'WinMain' referenced from borland\...\lib\cow32.obj

    and i have re-created opengl32.lib and glu32.lib with implib.

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    try looking at the stuff here:

    http://nehe.gamedev.net/default.asp

    and here:

    http://fly.cc.fer.hr/~unreal/theredbook/

    The latter is more theory. The former offers practical advice and examples.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    ok thanks elad

  6. #6
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    link to the glaux.lib
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    Originally posted by no-one
    link to the glaux.lib

    when i try to link it with glaux.lib i get following error

    c:\borland\bc5\lib\gl\glaux.lib contains invalid omf record,type 0x21 (possibly coff)

    and i downloaded new glaux.lib from
    www.starstonesoftware.com/OpenGL/download.htm

  8. #8
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    wellll... there are several thing's i've seen on this...

    and basically you need to convert your opengl libs, from coff to omf...

    i've never dont this and i don't have a borland compiler, so...

    this site has some info in the troubleshooting section at the bottom of the page...
    http://ucsub.colorado.edu/~macklem/borland.html

    if all else fails... http://www.google.com
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    All else fails so
    thats the place where i should go now.
    Originally posted by no-one

    if all else fails... http://www.google.com
    and i have imported all lib's from dll's, even glut lib.And still same error.Maybe i should try it with visual c++.

  10. #10
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    well...now i compiled it with visual c++
    and thats what i got:
    Linking...
    Firstgl.obj : error LNK2001: unresolved external symbol __imp__glFlush@0
    Firstgl.obj : error LNK2001: unresolved external symbol __imp__glClear@4
    Firstgl.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
    Firstgl.obj : error LNK2001: unresolved external symbol _auxInitWindowA@4
    Firstgl.obj : error LNK2001: unresolved external symbol _auxInitPosition@16
    Firstgl.obj : error LNK2001: unresolved external symbol _auxInitDisplayMode@4
    Debug/Firstgl.exe : fatal error LNK1120: 6 unresolved externals
    Error executing link.exe.

    Firstgl.exe - 7 error(s), 0 warning(s)

    any ideas?

  11. #11
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    You need to link with opengl32.lib and glaux.lib

    gg

    EDIT
    For VC++ 6.0
    Project->Settings->Link (tab): add "opengl32.lib glaux.lib" at the end of the "Object/library modules:" edit box.
    Last edited by Codeplug; 03-11-2003 at 07:41 AM.

  12. #12
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    it compiles well but when i link it, it says that:
    Code:
    Linking...
    glaux.lib : fatal error LNK1136: invalid or corrupt file
    Error executing link.exe.
    
    Firstgl.exe - 1 error(s), 0 warning(s)
    i downloaded new glaux library too but still same error

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  2. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 04:23 PM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 06:57 PM
  4. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

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