Results 1 to 10 of 10

Thread: problems with VC++ and linking

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2001
    Posts
    10

    problems with VC++ and linking

    I know this isn't openGL related but I was wondering if anybody has any ideas as to what would cause this error:
    Linking...
    LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Release/Triangle.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

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

    Am I forgetting an includes file or am I missing some .dll file. Any help as to where to look or what the problem might be would be especially helpful.

  2. #2
    Guest

    Re: problems with VC++ and linking

    If your program has a main function ( not WinMain) should you create a console app.

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2001
    Location
    london ont canada
    Posts
    25

    Re: problems with VC++ and linking

    do you compile fine for a debug build (it looks like you are doing a release build, judging by the error returned)? if so, take a look at your project settings.

    you may have something in your debug link settings that aren't present in your release.

    [This message has been edited by dallas (edited 07-17-2001).]

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

    Re: problems with VC++ and linking

    You are trying to compile a console and don't have a main function (thus the linker can't find it). You're most likely using a WinMain function for the entry point so you should start the app as a Win32 Application project, not a Win32 console project. The two projects are essentially the same except for the entry points they expect.
    Deiussum
    Software Engineer and OpenGL enthusiast

  5. #5
    Member Newbie
    Join Date
    Dec 2000
    Location
    Donetsk, Ukraine
    Posts
    48

    Re: problems with VC++ and linking

    I also had such problem, but when compiling .dll file. It may be solved in different ways:
    1) play with your Code Generation option in project settings.
    2) explicitly add msvcrt.lib(release) and msvcrtd.lib(debug) to your project.

  6. #6
    Junior Member Newbie
    Join Date
    Jul 2001
    Posts
    10

    Re: problems with VC++ and linking

    Thanks guys I'll give it a try and see what happens. Its probably the case because I was trying to get rid of GLUT in favor of a windows app. and using some directx.

  7. #7
    Junior Member Newbie
    Join Date
    Jul 2001
    Posts
    10

    Re: problems with VC++ and linking

    Sorry about the ineptitude but I'm really new to these types of errors. I didn't list all of the errors but they are very similiar and probably stem from the same problem. I don't know if I have all of the settings for the project right I changed my project to a win32 app. instead of a win32 console app. and now i'm getting all of these errors.


    main.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
    main.obj : error LNK2001: unresolved external symbol __imp__glVertex3f@12
    main.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
    main.obj : error LNK2001: unresolved external symbol __imp__glTranslated@24
    main.obj : error LNK2001: unresolved external symbol __imp__glTranslatef@12
    main.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
    main.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
    Debug/tank game.exe : fatal error LNK1120: 31 unresolved externals
    Error executing link.exe.

  8. #8
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    France
    Posts
    15

    Re: problems with VC++ and linking

    You now have to add some *.lib to your project settings. Links fail because your declare some functions (in gl.h, glu.h and glaux.h) but VC++ can't find implementation of these. I think you need files like opengl32.lib and perhaps there are some other files like glu32.lib and glaux32.lib. I am quite sure it is your problem. And there is no problem with your questions, we all began one day....and at this time, I didn't know Opengl forum... : (
    Sebb

  9. #9
    Junior Member Newbie
    Join Date
    Jul 2001
    Posts
    10

    Re: problems with VC++ and linking

    Thnaks for the help I'll give it a try and see what happens.

  10. #10
    Junior Member Newbie
    Join Date
    Jul 2001
    Posts
    10

    Re: problems with VC++ and linking

    Thank you for your help I really appreciate it. It worked like a charm and I can finally get back to learning openGL instead of tinkering with vis. c++.

Similar Threads

  1. having problems linking
    By codecrank in forum OpenGL: Linux
    Replies: 3
    Last Post: 01-31-2004, 02:31 PM
  2. Linking problems or GLX?
    By sglo in forum OpenGL: Linux
    Replies: 28
    Last Post: 01-26-2004, 03:39 PM
  3. problems with *.lib linking.
    By zenon in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 02-21-2003, 11:48 AM
  4. glx linking problems... please help !
    By Monseigneur in forum OpenGL: Linux
    Replies: 2
    Last Post: 04-09-2002, 12:42 AM
  5. linking problems
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-01-2002, 01:14 AM

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