Menu

adding libraries

2003-09-11
2012-09-26
  • Nobody/Anonymous

    I would like to add a library particularly the 'apstring.h' library.  I have the file downloaded.  and I've placed it inside the 'include' folder of 'Dev-C++', but I can't use it.  Did I do something wrong?

    Thanks,
      GAT

     
    • Nobody/Anonymous

      .h files are headers.
      .a files are libraries.

      .a files are object files, .h files are text files.

      .a files generally need a correspondent .h file to holds its function prototypes plus other stuff.
      .h files are useless without their correspondent library.

      .h files have to be in the path for "includes" in dev-c++ configuration.
      .a files have to be in the path for "libraries" in dev-c++ configuration.

      .h files can be in the same directory as your project as long as you #include the header using "" instead of <> or use "complete path" or <complete path>.
      .a files can be in the same directory as your project as long as you inform Dev-C++ of it at project, project options, parameters, add library or object: dev-c++ will link the file using the complete path instead of using -lsomething because the lib is not at the default lib directory.

      And for apstring specific info, once every 15 days for the last year or more somebody starts a thread on this. If you use the search facility of this forum you will find extensive information on that.

       
    • Wayne Keen

      Wayne Keen - 2003-09-11

      Here are my simple rules of thumb for dealing with new, general libraries:

      (1) Put the header (.h) files in the include directory
      (2) Put the library files (.a) files in the lib directory
      (3) If there is an associated .dll file, I put that in either the bin directory, or the windows\system32 directory

      Remember, header files are the map, and library files are the code.  You must include the right header in your code, and you must link the right library at compile time.  The library link command links the library name, not the file name.  This means the gsl library, which is found in the file libgsl.a, is linked by the command

      -lgsl

      Wayne

       
    • Wayne Keen

      Wayne Keen - 2003-09-11

      I won't tell you how long that took me to figure out when I was first teaching myself this stuff....ack...what a dork....

      Wayne

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.