GNU Copiler

Discussion in 'C++' started by ZikO, Nov 2, 2009.

  1. ZikO

    ZikO Guest

    hi all

    I have recently found something I was not conscious using GNU C compiler
    v 4.4.0. I have created a simple program just to be run in command line.
    However, when I tried to run it on someone's else computer, it asked me
    about a library. I don't remember which one but I am not happy with that
    because it means i cannot create a full standalone program. Whenever I
    want to use it on any other computer it will required this library.

    Do you have any suggestion how I could compile the program so that it
    would be independent on any libraries? or which exact libraries are
    required by programs compiled with GNU?

    Thanks for any suggestion.

    Regards
     
    ZikO, Nov 2, 2009
    #1
    1. Advertising

  2. ZikO wrote:
    > I have recently found something I was not conscious using GNU C compiler


    C? This is a C++ newsgroup (in case you didn't know, they are different
    languages).

    > v 4.4.0. I have created a simple program just to be run in command line.
    > However, when I tried to run it on someone's else computer, it asked me
    > about a library. I don't remember which one but I am not happy with that
    > because it means i cannot create a full standalone program. Whenever I
    > want to use it on any other computer it will required this library.
    >
    > Do you have any suggestion how I could compile the program so that it
    > would be independent on any libraries? or which exact libraries are
    > required by programs compiled with GNU?


    This question is better asked in the GNU C forum (gnu.gcc.help) or in
    the forum for your OS.

    In Windows world, for example, it is necessary to compile your program
    with C run-time (CRT) library as "static" (versus "dynamic") to only
    allow calls to Windows API to be resolved at run-time (and they always
    should be since the dynamic libraries that provide the API are always
    present).

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Nov 2, 2009
    #2
    1. Advertising

  3. ZikO

    ZikO Guest

    Victor Bazarov wrote:
    > ZikO wrote:
    >> I have recently found something I was not conscious using GNU C compiler

    >
    > C? This is a C++ newsgroup (in case you didn't know, they are different
    > languages).
    >
    > This question is better asked in the GNU C forum (gnu.gcc.help) or in
    > the forum for your OS.
    >
    > In Windows world, for example, it is necessary to compile your program
    > with C run-time (CRT) library as "static" (versus "dynamic") to only
    > allow calls to Windows API to be resolved at run-time (and they always
    > should be since the dynamic libraries that provide the API are always
    > present).
    >
    > V


    Thanks V but I am even more confused now.

    Well, first thing, my program is in C++ not C, I only specified which
    compiler I used, which is GNU and can also compile C++ programs by using
    g++. I should have added those 2 little "+"s...

    Second, I don't understand what static and dynamic libraries are. If you
    would be so kind and explain it to me. Thanks.

    Regards.
     
    ZikO, Nov 3, 2009
    #3
  4. ZikO wrote:
    > [..]
    > Well, first thing, my program is in C++ not C, I only specified which
    > compiler I used, which is GNU and can also compile C++ programs by using
    > g++. I should have added those 2 little "+"s...


    OK, so now we're on the same page. You're actually using GNU C++. Good.

    > Second, I don't understand what static and dynamic libraries are. If you
    > would be so kind and explain it to me. Thanks.


    See, that's the thing, those aren't really specified by the language
    itself. They are a feature of the operating system on which your
    program is running. That is, there are probably operating environments
    that have no way of distinguishing between the two, and some have no
    dynamic libraries whatsoever (AFAIK, and it's not much).

    A dynamic library is a module that the OS can load into the process'
    address space when your program starts (becomes a process), on demand,
    thus placing more code for your program to call. A static library is
    actually a set of object modules that can be linked to your program (and
    become part of it) when your program is being created. In Unix world,
    for instance, the static libraries often have the extension '.a'
    ("archive") and the dynamic ones '.so' ("shared object").

    It is rather difficult to explain all possible nuances of using dynamic
    libraries and static ones in a single newsgroup post, so you should seek
    more information from other sources available, like books, for example.
    It probably suffices to reiterate that static libraries contain code
    that needs to be *linked* before your program is ready, and dynamic ones
    contain code that is *linked* at the run-time.

    So, to have your question on how to create a program that doesn't
    require additional libraries answered, ask in the newsgroup for your OS.
    Or to find out what libraries you need to run your program, ask in the
    newsgroup for your OS. C++ *language* makes no effort to define what is
    defined by the operating system or the compiler. Please forgive the
    creators of the language for this major oversight.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Nov 3, 2009
    #4
  5. ZikO

    ZikO Guest

    Victor Bazarov wrote:
    > ZikO wrote:
    >> [..]
    >> Well, first thing, my program is in C++ not C, I only specified which
    >> compiler I used, which is GNU and can also compile C++ programs by using
    >> g++. I should have added those 2 little "+"s...

    >
    > OK, so now we're on the same page. You're actually using GNU C++. Good.
    >
    >> Second, I don't understand what static and dynamic libraries are. If you
    >> would be so kind and explain it to me. Thanks.

    >
    > See, that's the thing, those aren't really specified by the language
    > itself. They are a feature of the operating system on which your
    > program is running. That is, there are probably operating environments
    > that have no way of distinguishing between the two, and some have no
    > dynamic libraries whatsoever (AFAIK, and it's not much).
    >
    > A dynamic library is a module that the OS can load into the process'
    > address space when your program starts (becomes a process), on demand,
    > thus placing more code for your program to call. A static library is
    > actually a set of object modules that can be linked to your program (and
    > become part of it) when your program is being created. In Unix world,
    > for instance, the static libraries often have the extension '.a'
    > ("archive") and the dynamic ones '.so' ("shared object").
    >
    > It is rather difficult to explain all possible nuances of using dynamic
    > libraries and static ones in a single newsgroup post, so you should seek
    > more information from other sources available, like books, for example.
    > It probably suffices to reiterate that static libraries contain code
    > that needs to be *linked* before your program is ready, and dynamic ones
    > contain code that is *linked* at the run-time.
    >
    > So, to have your question on how to create a program that doesn't
    > require additional libraries answered, ask in the newsgroup for your OS.
    > Or to find out what libraries you need to run your program, ask in the
    > newsgroup for your OS. C++ *language* makes no effort to define what is
    > defined by the operating system or the compiler. Please forgive the
    > creators of the language for this major oversight.
    >
    > V

    Oh Dear ... It does not sound even familiar. Well, it's at least more I
    knew before, though, it's new stuff for me. I will look into some web
    pages to find something else.

    Thanks for help.

    Regards
     
    ZikO, Nov 3, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jasper
    Replies:
    0
    Views:
    493
    Jasper
    Jun 28, 2004
  2. Robert Mark Bram
    Replies:
    2
    Views:
    5,974
    Robert Mark Bram
    Dec 11, 2003
  3. Peter

    1 day gnu, whole life gnu?

    Peter, Jan 10, 2005, in forum: Java
    Replies:
    3
    Views:
    350
    John C. Bollinger
    Jan 10, 2005
  4. Peter
    Replies:
    17
    Views:
    611
    Chris Smith
    Jan 13, 2005
  5. Markus Elfring
    Replies:
    2
    Views:
    376
    Markus Elfring
    Feb 23, 2005
Loading...

Share This Page