473,785 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1677
"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
2569
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: 1. CallControlData does not provide a operator= 2. INUserHandle's operator= returns a object instead of a reference 3. Use CC -g main_leak.C instead of CC main_leak.C to compile. You change any of the above condition, there will be NO mem leak.
2
7644
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: AIX5.1, ML4, 32 bit Kernel, IBM c5.1 compile and Informix7.31. I can't compile my c source code on the same system by using "-q64" option and "OBJECT_MODE=32"environment, the c compiler raised the error: /usr/informix/lib/esql/libifsql.so can't be...
3
5267
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 (0xc0000005 at address 535F072A): likely culprit is 'BIND'. An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are...
7
1445
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
2648
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 of "hits" and "matches" in the guess. The program stops when the user guesses the correct number or runs out of guesses. For example, if the target number is 427, the guess 207 has one hit (7) and one match (2), whereas the guess 749 has two...
2
1197
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 compile the parent program.I mean to say that when I compile the parent program then the child program shold also be compiled with its errors ,if any and should show the output of both the programs.
39
2025
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 code is executed, it corrupts the memory causing a crash later on (the program actually causes an "access violation" error in Windows, which the program is running under):
4
8397
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 setup on my m/ c
2
8608
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 making a console application which launches the compilers for different programming languages. So far have I got compilers for Java, C/C++, C# and Pascal. This is how the program works: 1. The user types in the path to the file (s)he wants to...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10152
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8974
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.