469,576 Members | 1,770 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,576 developers. It's quick & easy.

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

Dear all,

I have written a C++ program 1.cpp

#include <stdioh>

main() {
}

then I compile with g++ 1.cpp, it generated a ./a.out.

[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)

[root@backup-server tmp]# objdump -x a.out | grep NEED
NEEDED libstdc++.so.5
NEEDED libm.so.6
NEEDED libgcc_s.so.1
NEEDED libc.so.6
VERNEED 0x804822c
VERNEEDNUM 0x1

why is there libm.so.6??? I dont have any math function called?

I need to modify an extremely complicated C++ project using only integer
and I need to prove to my client that the project does not use libm. However
seems I cannot get rid of libm. Could anyone help?

Hong
Jul 22 '05 #1
1 1525
"nospam" wrote:
I need to modify an extremely complicated C++ project using only integer
and I need to prove to my client that the project does not use libm. However
seems I cannot get rid of libm. Could anyone help?


Usually, reading a programs man page is quite useful. Here you could
find out that -nodefaultlibs disables the default linking libraries.
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mark Rockman | last post: by
7 posts views Thread by storyGerald | last post: by
1 post views Thread by sunnyhanda | last post: by
39 posts views Thread by mike3 | last post: by
4 posts views Thread by fd97207 | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.