C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-04-2009, 07:37 AM   #1
Registered User
 
Join Date: Dec 2007
Location: France
Posts: 396
Linking + size

When you link a library in the linking settings and you will compile a file (not a project)
that doesnt need this library, will it still compile the library with the file or only will do so if it needs it?

Im asking this because if you have a few libraries set, it could raise both the size and the compile time.

Im using codeblocks with VC 2008 and it doesnt seem to have augmented the size of the executable.
__________________
Using Code::Blocks,MingW with Windows.
Ducky is offline   Reply With Quote
Old 07-04-2009, 07:50 AM   #2
Student
 
legit's Avatar
 
Join Date: Aug 2008
Location: UK -> Newcastle
Posts: 156
If you link it, then it will compile it. (I Think)
__________________
MSDN <- Programmers Haven!
legit is offline   Reply With Quote
Old 07-04-2009, 08:41 AM   #3
Registered User
 
Join Date: Dec 2007
Location: France
Posts: 396
Yes thats what i thought too.

Thats why its better to use pragma comment, that way you dont need to create a project for every little file you compile.
__________________
Using Code::Blocks,MingW with Windows.
Ducky is offline   Reply With Quote
Old 07-04-2009, 11:33 AM   #4
and the Hat of Guessing
 
tabstop's Avatar
 
Join Date: Nov 2007
Posts: 8,740
I suppose you can always test it out to be sure (add some extra libraries in your command line, see if the size changes). If you're linking statically, for whatever reason my belief was always that only the code you used was linked in.
tabstop is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
size of array goran00 C Programming 38 04-02-2008 09:57 AM
Heapsort xENGINEERx C Programming 2 03-30-2008 07:17 PM
Generic heapsort Sephiroth1109 C Programming 15 12-07-2007 06:14 PM
An exercise in optimization Prelude Contests Board 10 04-29-2005 03:06 PM
linking errors sentienttoaster C++ Programming 4 11-30-2003 03:01 PM


All times are GMT -6. The time now is 05:54 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22