Thread: Noob question: installing (or "installing") headers and libraries

  1. #1
    Registered User
    Join Date
    Aug 2016
    Posts
    3

    Noob question: installing (or "installing") headers and libraries

    Hello.

    Continuing with my first steps here and, after a few days of Google didn't provide an answer, I'll try here.

    I am learning C and using Linux Mint. I want to use some "privately-created" headers and libraries, but have encountered difficulties when persuading the compiler to get acquainted with them. Can anyone tell me if there is some general method of "installing" additional headers and librraies in the appropriate manner so that the "installation programme" does all the work, puts everything into its place so that I can merrily go my way, or do I have to track down all the relevant directories by myself and place files where they are supposed to be?

    I tried simply dumping everything I downloaded into /usr/include, but it didn't quite work. (The catch may have been that the headers I "installed" actually called some other headers that the compiler couldn't find so maybe the problem is that the stuff I'm trying to "install" isn't complete, that's why I'm asking the general question first: what is the proper/usual way to install them.)

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    The usual place to install things that you want to be generally available on your own system is in /usr/local/include.

    Code:
    $ echo | gcc -xc -E -v -
    ...
    #include "..." search starts here:
    #include <...> search starts here:
     /usr/lib/gcc/x86_64-linux-gnu/5/include
     /usr/local/include
     /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
     /usr/include/x86_64-linux-gnu
     /usr/include
    End of search list.
    # 1 "<stdin>"
    # 1 "<built-in>"
    # 1 "<command-line>"
    # 1 "/usr/include/stdc-predef.h" 1 3 4
    # 1 "<command-line>" 2
    # 1 "<stdin>"
    Of course, there is also the option of putting various -I/path/to/here options on the command line whenever you want to compile with one of your own libs.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Installing" std_lib_facilities.h" on MinGW
    By dbuff in forum C++ Programming
    Replies: 2
    Last Post: 10-07-2011, 12:41 PM
  2. Replies: 8
    Last Post: 11-29-2008, 11:45 PM
  3. trouble with installing "microsoft visual c++"
    By aleminio in forum C Programming
    Replies: 3
    Last Post: 04-28-2004, 09:32 AM

Tags for this Thread