LNK4221 and LNK4006

This is a discussion on LNK4221 and LNK4006 within the C++ Programming forums, part of the General Programming Boards category; I am making a static lib of my own. I took a third party lib to make my code and ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    5

    LNK4221 and LNK4006

    I am making a static lib of my own. I took a third party lib to make my code and want basically included that as another lib in my static lib project in vs2008. Can anyone tell me how do i get rid of these?

    I usually get a the lnk4006 for every function in the obj followed by a lnk4221 for that obj.

    I am just not sure what I am doing wrong. is it the vs2008 config settings? something i am missing?the code is very straight forward that just calls some function from this third party lib and that i do in the .cpp. the .h just has the api in it and all the include file as well as the param for the lib i am using. just need some help on this as I can't seem to get these to go away. i am at a loss here.



    LNK4221: no public symbols found; archive member will be inaccessible.
    followed by

    LNK4006......second definition ignored.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Every function in your lib or every function in the third-party lib?

    (And I'm just going to assume for now that the license for the third-party lib allows redistribution....)

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    5
    every function in the third party lib. none of mine.

    and yes its a free lib that can be used by anyone. does that help?

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I am not currently sitting at a machine with VS on it, so I don't remember the exact clicks, but you're looking for something like project -> properties -> C/C++ -> linker. Somewhere you need to specify the .lib file as a file that gets linked into your project.

    Looking it up at MSDN gives .lib Files as Linker Input.

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    5
    if the solution is a static lib it has somerthing called a librarian that you can set the lib for any dependancies which i did. it does not have the linker option in it. I think if it were some other type of application type other than static lib than those solutions properties has the linker option.

    so some of the things i did was have the paragma option with my lib.
    I also have it in the librarian

    I also found this....
    http://support.microsoft.com/default...b;EN-US;815773

    seems like just by adding a resource to my static lib...in this case this third party lib you get the linker warnings.
    I am not sure what the solution would be for that......
    Last edited by khumayun; 03-23-2010 at 09:43 AM.

  6. #6
    Registered User
    Join Date
    Mar 2010
    Posts
    4
    Check whether you can compile your program as EXE, not LIB. If everything is ok with EXE, then perhaps it is an exporting issue of your code and 3rd party headers. Give some more info about 1-2 exact functions and what the errors are.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker warning LNK4006
    By VirtualAce in forum Game Programming
    Replies: 5
    Last Post: 09-19-2008, 09:53 PM

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