Results 1 to 3 of 3

Thread: Link warning

  1. #1

    Default Link warning

    I took Guitest program and spit into guitest.h and guitest.cpp.
    Compiling does not give me any error, but linking gives m some warning.
    And the exe file is only 120k compare to the working one which was 1.2M.
    How can I fix it?

    Thanks.

    Here the buid result :
    guitest.cpp
    C:\Users\Tuy Solang\Clanlib\Tests\GUITest\guitest.cpp(37) : warning C4101: 'w1' : unreferenced local variable
    C:\Users\Tuy Solang\Clanlib\Tests\GUITest\guitest.cpp(37) : warning C4101: 'w2' : unreferenced local variable
    C:\Users\Tuy Solang\Clanlib\Tests\GUITest\guitest.cpp(37) : warning C4101: 'x2' : unreferenced local variable
    C:\Users\Tuy Solang\Clanlib\Tests\GUITest\guitest.cpp(36) : warning C4101: 'j' : unreferenced local variable
    C:\Users\Tuy Solang\Clanlib\Tests\GUITest\guitest.cpp(36) : warning C4101: 'k' : unreferenced local variable
    Linking...
    LINK : warning LNK4089: all references to "GDI32.dll" discarded by /OPT:REF
    LINK : warning LNK4089: all references to "GLU32.dll" discarded by /OPT:REF
    LINK : warning LNK4089: all references to "OPENGL32.dll" discarded by /OPT:REF
    LINK : warning LNK4089: all references to "ole32.dll" discarded by /OPT:REF

    GUITest.exe - 0 error(s), 9 warning(s)

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    You can safely ignore those warnings. They are output because the linker is told to link with gdi32.lib, glu32.lib, opengl32.lib and ole32.lib, but after the linker removed all functions that were not being used those libraries lost all references to them.

    For example, if you only use 3 functions in clanGL and none of those 3 functions actually needed OpenGL, then /OPT:REF causes the linker to not put the remaining 3000 other functions in clanGL into your executable. The warning then appears because it now discovered that linking with opengl32.lib is pointless when you don't use anything in it, so it removes the linking with opengl32.lib and writes a warning to let you know it did this.

    If you absolutely insist of getting rid of this warning, either remove /OPT:REF (not recommended) or add /NODEFAULTLIB or tell it to explicitly not to link those library files. However, if you tell it to not link with those libs, and you suddenly start using more of clanGL and that makes it need opengl32.lib, then you will start getting linker errors until you allow it to link with opengl32.lib again.

  3. #3

    Default

    Thank for the info.
    I didn't know that I have to specify guitest as app after breaking guitest
    into guitest.h and guitest.cpp.

    Now, the application is working.

Similar Threads

  1. Linker Warning i Borland Turbo C++
    By hilltop_sun in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 01-29-2007, 08:14 AM
  2. Server link
    By in forum Funeral Quest
    Replies: 2
    Last Post: 06-05-2005, 09:59 PM
  3. Whats with the link to Dink?
    By in forum Dink Smallwood HD
    Replies: 2
    Last Post: 09-29-2003, 10:16 PM
  4. I need a direct link to daisypark
    By jimbobbucky in forum Funeral Quest
    Replies: 5
    Last Post: 09-20-2003, 09:50 PM
  5. Why does the BYG server link
    By jimbobbucky in forum Funeral Quest
    Replies: 20
    Last Post: 06-23-2003, 12:56 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •