CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2005
    Posts
    62

    Release mode problem

    Hi to all,

    If I am compiling through debug mode my project works fine but I am compiling through release mode it gives following warning and program crashes at runtime.

    LINK : warning LNK4089: all references to "ADVAPI32.dll" discarded by /OPT:REF
    LINK : warning LNK4089: all references to "MSVCP60.dll" discarded by /OPT:REF

    The above warning is given by compiler if am included one .cpp and .h file in my project.In that file I have included
    #include <string>
    #include "stdafx.h"

    these two files and used STL string class.

    I hope that I got answer from u.

    Rahul

  2. #2
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Lightbulb Re: Release mode problem

    Error occurs due to.
    all references to 'dynamic-link library' discarded by /OPT:REF

    The linker discarded all packaged functions that referenced exports in
    dynamic-link library. As a result, dynamic-link library is not needed for
    execution of the image.

    You may want to consider removing references to dynamic-link library to
    speed up the build.

    Other occurrences of this warning can occur if an unused function in your
    code references a .dll export that the linker has discarded. Use /VERBOSE
    to see which of your functions the linker is discarding and then remove
    them from your code.

    for more details just go through MSDN and see how to use /VERBOSE

  3. #3
    Join Date
    Sep 2005
    Posts
    19

    Re: Release mode problem

    No reason to worry... linker just says that as you dont need anything from these two files so the references to them are removed.

    Just researched that myself...

    If it seems to cause you trouble in in your application tho its unlikley you can remove the /OPT:REF parameter from linker options and this optimization does not occur.
    Last edited by alexiadeath; September 23rd, 2005 at 03:30 AM.
    Learning is a way of life...
    A question you never ask, cannot be answered.

  4. #4
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Release mode problem

    [ merged thread ]

    Please do not post the same question in multiple forums. Thank you.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  5. #5
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Release mode problem

    Well, the program crash has some other reason. BTW, you should include "stdafx.h" before any other file.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  6. #6
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: Release mode problem

    You're sure this linker warning is related to the runtime crash?

    The LNK4089 is just a warning telling you that you've referenced a library (you've told the linker too link a library), but the library is never used (no part of your code is using the library).

    You should remove the library(-ies) from your project if you don't use them.

    - petter

  7. #7
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503

    Re: Release mode problem

    merged threads! please avoid cross posts...
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  8. #8
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured