CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2007
    Posts
    5

    Talking How to Link a Library?

    Howdy all.

    I'm following a tutorial out of a book to create a window using SDL.
    The problem is that I don't know how to add the SDL libraries to my project.

    The libraries for SDL are in the following directory:
    C:\SDL\lib

    The headers are in this directory:
    C:\SDL\include

    and my project is in:
    C:\Documents and Settings\Admin\My Documents\Visual Studio 2005\Projects

    I'm using Visual C++ Express 2005.

    In the book all it says it "Do not forget to link your project to the sdl.lib and the sdlmain.lib libraries"

    I've tried going into my project properties->common properties->references and adding a new reference but there isnt anything there.

    Also, in C/C++ ->Additional Include Directories I've added C:\SDL\include.

    If someone could direct me to a tutorial or just explain to me how to add libraries outside of your project I'd really appreciate it.

    My project only includes my 1 source file which includes SDL.h.

    The source is attached.


    THANK YOU!
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2007
    Posts
    12

    Re: How to Link a Library?

    By code:

    #pragma comment( lib, "libname" )

    (include the relative path if it is not in the main application folder -or set Additional Library Directories in the properties dialogue)

    In properties:

    Linker->Input->Additional Dependencies

  3. #3
    Join Date
    Jun 2007
    Location
    MA-USA
    Posts
    247

    Smile Re: How to Link a Library?

    Alternately you can add the linker command to your project file.

    Using the menu...PROJECT-SETTINGS-LINK

    Now you can enter the library into the edit box.

    Happy Coding!

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