Thread: How to create my own librarie?

  1. #1
    Registered User
    Join Date
    Sep 2020
    Posts
    6

    How to create my own librarie?

    Hi, i know there is already a lot of similar questions on the internet but I just can't find any specific answer to the folowing question:

    How to create a librarie that could be used without having to add options when compiling my program?

    Just like we do when using stdlib.h or stdio.h.

    If you have any idea on how to do this or have a link that you think might help me, please let me know.

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    498
    Quote Originally Posted by Mpetou View Post
    Hi, i know there is already a lot of similar questions on the internet but I just can't find any specific answer to the folowing question:

    How to create a librarie that could be used without having to add options when compiling my program?

    Just like we do when using stdlib.h or stdio.h.

    If you have any idea on how to do this or have a link that you think might help me, please let me know.
    It depends on your compiler. Building a library is not something you'll do for practical purposes much as a beginner. You might be asked to build one as a learning exercise.

    A library is basically just a list of object files. There are slightly different types depending on whether the library is statically or dynamically linked. It's a case of knowing the options on your particular platform. If you are using an IDE then there's usually a "target type" or similar variable in the IDE project settings that you can set to "create library".

    SSorry not to be more specific.
    I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
    Visit my website for lots of associated C programming resources.
    https://github.com/MalcolmMcLean


  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    4,595
    Also please note that "stdlib.h" and "stdio.h" are header files, not libraries. These headers describe functions contained in the standard library.

    How to create a librarie that could be used without having to add options when compiling my program?
    I'm not aware of any easy way to make a user library that you could use without informing the compiler of their existence and their locations.

    There are even some standard libraries that sometimes require you to tell the compiler to use them, ie: the math standard library .

  4. #4
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    340
    Include Syntax (The C Preprocessor)

    #include "file"

    "It searches for a file named file first in the directory containing the current file"
    Last edited by Structure; 09-06-2020 at 06:32 AM.
    "without goto we would be wtf'd"

  5. #5
    Registered User
    Join Date
    Sep 2020
    Posts
    6

    thanks for the answer

    Thanks for the answer, I am supprised that we actually have to speciefe the libraries that we use twice (first in the source code and then when compiling).
    I guess I'll have to make an alias.
    Thanks again for the answer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Create CGI with c++
    By sivahanuman in forum C++ Programming
    Replies: 1
    Last Post: 07-17-2017, 12:25 AM
  2. How create and use DLL in Dev-C++
    By atztek in forum C Programming
    Replies: 0
    Last Post: 12-13-2015, 08:29 AM
  3. create and populate create bidimensional array
    By darkducke in forum C Programming
    Replies: 0
    Last Post: 12-03-2010, 07:06 AM
  4. how to create this?
    By ichimarugin in forum C++ Programming
    Replies: 3
    Last Post: 08-10-2008, 05:20 PM
  5. Create a URL?
    By Yarin in forum C++ Programming
    Replies: 9
    Last Post: 09-26-2007, 11:22 AM

Tags for this Thread