473,398 Members | 2,427 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,398 software developers and data experts.

questions about link

My project uses many libraries like libjpeg, libpng and more.
With all of these libraries linked statically and with many .cpp files
of my project, a big binary executable is predictable.

I'm impressed when I was remove the code inside 'main(...)' and all of
the includes, but executable size doesn't change, at all.

There are many *.cpp files but in test.cpp which implements 'main' there
is only this code:
----test.cpp--------
int main(int argc, char **argv)
{
return 0;
}
--------------------

size for this executable is about 290KBs and inside binary I recognize
parts of zlib library. I use zlib library in other .cpp file than
test.cpp, but I don't call anything from this file and if I remove it,
all work ok and size decreases.
If I remove all files except test.cpp, it compiles fine and size is 10KBs.

So the question is why linker include useless binary objects to final
binary executable.

My compiler/linker is mingw-g++, if does matter.
Jan 17 '07 #1
2 1243
Chameleon wrote:
[redacted]
Linker behavior is not defined by the language, as well as being
tool-specific, and is thus off-topic of this newsgroup.
>
My compiler/linker is mingw-g++, if does matter.
Yes, it does, it allows me to direct you to the proper newsgroup. Try
gnu.g++.help.

Jan 17 '07 #2
Chameleon wrote:
My project uses many libraries like libjpeg, libpng and more.
[..executable size depends on libraries linked to..]
So the question is why linker include useless binary objects to final
binary executable.

My compiler/linker is mingw-g++, if does matter.
The language does not define how libraries are linked to, and what
the resulting executable size should be. Your question is not really
possible to asnwer in terms of the language. Your best bet is to ask
in the newsgroup dedicated to your compiler/linker or your OS (where
linking is actually defined). My guess would be that the library has
some static objects which get inserted in your executable and their
presence requires a bunch of object modules to be pulled in...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jan 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Garmt de Vries | last post by:
For a long time, I've used CSS to style my webpages, but only for media "screen" and "print". Now I've started looking into styling them for other media like "projection" and "handheld". I'd be...
5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
4
by: Ramesh | last post by:
hi, Let me ask some basic questions. Can anybody explain me about the following questions: 1. When we have to create sn key? Whenever we compiled Component we have to create or it is a one time...
0
by: Ivan Demkovitch | last post by:
Hi! This is a long one :-) Please correct me if I *did* something wrong and help me with my questions (at the end) I'm learning C# and .NET but good at SQL. I'm working on portal and...
3
by: Alan Silver | last post by:
Hello, I am just looking at the tree view control, which looks very good, but has some apparent limitations. This could easily be my lack of experience with it. Specifically, I have two...
1
by: Jeff | last post by:
Hey IDE: VS .NET 2005 #1 I want to start developing web parts in visual studio 2005 and are wondering where is the latest version of the web part templates. I did find this download (the...
0
by: tccode97 | last post by:
To whom it may concern, I am developing a socket application in VC++ that uses asynchronous connnection. After doing search on google, I found the following link ...
4
by: MrHelpMe | last post by:
Hello experts, Using asp with javascript and after reading many articles I found that 1 way to hide url is to use frames. However, my application has a form in which the user enter's values and...
0
leafgreen
by: leafgreen | last post by:
Hey everyone. Thanks for helping me with these two super-simple newbie questions. I use DW8. 1. On this page http://adswebsite.net/yahoo-search-versus-google-adwords, on the right column where it...
22
by: gustum | last post by:
Im graduating in the coming december. Anyone pls guide me where i can get c++ interview questions. I shall be very thankful to you if you provide me good link so any stuff if you have regarding...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.