Results 1 to 8 of 8

Thread: static libraries

  1. #1

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    static libraries

    im trying to make a *simple* static library with only one function inside it. all it does it multiply two numbers together and thats it. now when i compile the .lib file there are no errrors and theres nothing wrong. When i include the header file with another project (header file has been copyed to the same directory) it gives me these error.

    uselibtest error LNK2019: unresolved external symbol "double __stdcall multnum(double,double)" (?multnum@@YGNNN@Z) referenced in function _main

    uselibtest fatal error LNK1120: 1 unresolved externals
    any ideas whats wrong?

    Cheers

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Did you move the .lib file to somewhere in the compiler's library path? Also you need to tell it to link against that library.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    Originally posted by parksie
    Also you need to tell it to link against that library.
    how do i do that?

    Cheers

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    For VC++, go to Project Settings, then the Linker tab. Add the filename of the .lib file to the list
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    do u know where it is in VC++ 7, because i cant find it?

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Right-click the project in the solution explorere, select properties.
    Go to Linker->Input and add the name to the additional dependencies.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    okay, i can only get to the linker part when the project congiuration is set as .DLL and im trying to make a .LIB???

  8. #8
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    No, you've *made* the .lib already. You need to add it to the linker settings for the DLL or program you're creating. A .lib file doesn't go through the linker, therefore no Linker settings.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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