Linking: Without Creating Projects

This is a discussion on Linking: Without Creating Projects within the Windows Programming forums, part of the Platform Specific Boards category; Okay, so, using Dev-C++, I've downloaded a library that I'd like to use (has some functions in it that could ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    18

    Linking: Without Creating Projects

    Okay, so, using Dev-C++, I've downloaded a library that I'd like to use (has some functions in it that could make life alot easier).

    The problem comes to be that I don't know how to link the library to the code.
    I've been looking around at how to do it but all I've gotten is that I need to use a project in order to link (even then, I'm lost as to how they're linking stuff using that). Long and short is that I've found that for what I'm doing, projects are a waste of time and effort as they simply complicate things more than what I currently understand.

    So, how do you link a library (in Dev-C++) with your executable without creating a project each and every single time? (I am assuming that there is a way since you don't need to create projects in order to use stdlib.h, cstdlib, etc.)

    If this is a totally "noob" question then please bear with me.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    In the project settings, there is a dialog which allows you to set the names and locations of additional libraries you want to use with your project.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User mikeman118's Avatar
    Join Date
    Aug 2007
    Posts
    183
    If you don't know how to do that, you add this to your declarations:
    Code:
    #pragma comment(lib, "whatever.lib")
    Of course, replace whatever with the name of the .lib file, and make sure it's in the same folder.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by mikeman118 View Post
    If you don't know how to do that, you add this to your declarations:
    Code:
    #pragma comment(lib, "whatever.lib")
    Of course, replace whatever with the name of the .lib file, and make sure it's in the same folder.
    That only works in some compilers - in fact, as far as I know, only Microsofts Visual C/C++ supports it.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Nov 2007
    Posts
    18
    Code:
    #pragma comment(lib, "whatever.lib")
    This doesn't seem to work...

    In the project settings, there is a dialog which allows you to set the names and locations of additional libraries you want to use with your project.
    Yes, I've already heard that before. Is there a way though (or an easy way) of connecting the program with the resource without all the overhead of having to create a project and all the settings that projects create.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. Linking objects to your C++ projects
    By Dwizard in forum Windows Programming
    Replies: 5
    Last Post: 09-24-2005, 07:11 PM
  3. Two questions (Linking Libraries and Creating Them)
    By Thantos in forum Linux Programming
    Replies: 3
    Last Post: 03-21-2004, 04:01 PM
  4. creating big projects
    By devil@work in forum C++ Programming
    Replies: 4
    Last Post: 04-04-2003, 03:17 PM
  5. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 01:45 PM

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