473,396 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1659
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Scott Niu | last post by:
Hi, I have this following simple c++ program, it will produce memory leak ( see what I did below ). My observation also showed that: There will be a mem leak when all the 3 conditions are true:...
2
by: zhouhaiming | last post by:
On our test machine I can compile my c source code on AIX5.1(ML4) by "- q32" option and "OBJECT_MODE=32" environment variable, and it can correctly running. My operation system environment is:...
3
by: Mark Rockman | last post by:
------ Build started: Project: USDAver2, Configuration: Debug .NET ------ Preparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error...
7
by: storyGerald | last post by:
Usually, people write the program like this: // a very easy example: #include <cstring> int main() { size_t length = strlen("Hello, world!\n"); return 0; }
1
by: sunnyhanda | last post by:
Write a program that will generate, but not display, a three-digit "target" number that has three distinct digits. Then, inputs a maximum of eight user guesses and, for each guess, outputs the number...
2
by: Subhrangsu Chandra | last post by:
I have created a MF-COBOL Program which generates an another COBOL Program.Now I am in search of the system command which can compile the newly(I am calling it as "child") created program when I...
39
by: mike3 | last post by:
Hi. I was writing a program in C++ that generates fractals. I got this weird bug though right now that's holding it up and was wondering if you could help. Anyway, it seems that when this...
4
by: fd97207 | last post by:
when I did a dir libm.a on my m/c I was surprised to find the size of the file is only about 500 bytes. What does it contain? And from which file does the math code actually come from? I have MinGW...
2
by: Saser | last post by:
First post, lol. Please bear with my English, I'm a 14 year old guy from Sweden. I just started learning C# a few days ago, so I wanted to create something simple (but yet still useful). I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.