Thread: Book's code: Problematic

  1. #1
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331

    Book's code: Problematic

    attached is my cpp file, all the code is right out of my book and i'm not quite sure how to fix it yet....try compiling it and you'll see.

  2. #2
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    The header file is <GL/GLaux> not <GL/GLuax>

    float armAngle[2] = {0.0f, 0.0f);
    That, obviously should be ended with '}' as opposed to ')' but I know it's hard to mistake the two on higher resolutions.
    glTranslate()
    The function is glTranslatef();

  3. #3
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    yea the {} was an oops. Thnx for the help man.

  4. #4
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    i made thos changes now i get this on the globals. Also those floats need the { } on them, not the ( ).

    --------------------Configuration: Page131OGL - Win32 Debug--------------------
    Compiling...
    Page131OGL.cpp
    C:\Program Files\Microsoft Visual Studio\MyProjects\Page131OGL\Page131OGL.cpp(29) : error C2440: 'initializing' : cannot convert from 'const float' to 'float [2]'
    There are no conversions to array types, although there are conversions to references or pointers to arrays
    C:\Program Files\Microsoft Visual Studio\MyProjects\Page131OGL\Page131OGL.cpp(30) : error C2440: 'initializing' : cannot convert from 'const float' to 'float [2]'
    There are no conversions to array types, although there are conversions to references or pointers to arrays
    Error executing cl.exe.

    Page131OGL.exe - 2 error(s), 0 warning(s)
    Last edited by RoD; 01-20-2003 at 03:03 PM.

  5. #5
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    You can use plane simple typecasting for that.

  6. #6
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    posted wrong errors:

    Code:
    --------------------Configuration: Page131OGL - Win32 Debug--------------------
    Linking...
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glPopMatrix@0
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glVertex3f@12
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glPushMatrix@0
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glScalef@12
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glTranslatef@12
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glColor3f@12
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glRotatef@16
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glFlush@0
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glClear@4
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
    Page131OGL.obj : error LNK2001: unresolved external symbol _gluPerspective@32
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
    Page131OGL.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
    Debug/Page131OGL.exe : fatal error LNK1120: 20 unresolved externals
    Error executing link.exe.
    
    Page131OGL.exe - 21 error(s), 0 warning(s)

  7. #7
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Looks like missing libs.....add OpenGL32.lib GLu32.lib and GLaux.lib

  8. #8
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    duh me.....i usually use pragma i forgot :P

  9. #9
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    GRRRR

    --------------------Configuration: RobotGL - Win32 Debug--------------------
    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/RobotGL.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    RobotGL.exe - 2 error(s), 0 warning(s)

  10. #10
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Originally posted by RoD
    GRRRR

    --------------------Configuration: RobotGL - Win32 Debug--------------------
    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/RobotGL.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    RobotGL.exe - 2 error(s), 0 warning(s)
    *Sniff Sniff* I smell a Console Application! Check if you don't
    accidently took a console app.

  11. #11
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    #pragma comment(linker, "/subsystem:windows")

  12. #12
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Eibro i think i love you man!

  13. #13
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Originally posted by RoD
    Eibro i think i love you man!
    ICQ 96370823, maybe we can make something of it

  14. #14
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    O.O

    ok i'm going over there now.....

  15. #15
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Originally posted by Eibro
    #pragma comment(linker, "/subsystem:windows")
    Yeah, well if you look 1 post above that one, you'lle see i gave
    you this answer already, not demand the honor or anything .

    I still recommand using a true Win32 program instead of a
    console app with that pragma line.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Explain this C code in english
    By soadlink in forum C Programming
    Replies: 16
    Last Post: 08-31-2006, 12:48 AM
  2. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  3. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM