help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to exclue libm when compile C++ program with g++


From: nospam
Subject: how to exclue libm when compile C++ program with g++
Date: Mon, 2 Aug 2004 22:41:19 +0800

Dear All,

    I am changing a C++ project so that it is independent of math library
and required only on integer
arithmetic. In order to prove that I have finished the job, i need to
demostrate that the final executable
does not need libm and of course run smoothly.....

    Then I disocver that no matter how hard I work on it, all C++ program
must need libm. Why?

    Here is one simple example:

    #include <stdio.h>

    int main() {
        printf("hello world!\n");
        return 0;
    }

    if I compile the above problem and ldd it, here is the result:

    [root@backup-server tmp]# ldd ./a.out
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40027000)
        libm.so.6 => /lib/tls/libm.so.6 (0x400da000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x400fc000)
        libc.so.6 => /lib/tls/libc.so.6 (0x42000000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

    Why is libm? Can anyone give me an C++ example how to print hello world
without libm library?

Hong




reply via email to

[Prev in Thread] Current Thread [Next in Thread]