LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-13-2014, 05:28 PM   #1
entz
Member
 
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453
Blog Entries: 3

Rep: Reputation: 40
Are gcc header and linker flags inclusive or exclusive?


Hi all,

Assume the following scenario. C source file is compiled with gcc using the following command.

Code:
gcc test.c -o test -I/path/to/headers -L/path/to/libs
Question 1: Would gcc search for the headers and libraries in those particular dirs exclusively, or would it include the default search path for both headers and libs?
In other words, does "-L/path/to/libs" set the library path or does it append to the default path?

Question 2: If the above appends, then how can I set the search path?
Think of a more complex situation involving cross compilation or a system-wide upgrade where a collection of newly built libraries are bundled to a certain location, with the intention of having gcc link binaries against those new libraries as opposed to the old system libraries

Kind Regards

Last edited by entz; 04-13-2014 at 05:32 PM.
 
Old 04-14-2014, 12:37 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,966

Rep: Reputation: 7886Reputation: 7886Reputation: 7886Reputation: 7886Reputation: 7886Reputation: 7886Reputation: 7886Reputation: 7886Reputation: 7886Reputation: 7886Reputation: 7886
http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
http://stackoverflow.com/questions/4...nker-order-gcc
...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
#include and linker flags icecubeflower Programming 4 11-24-2009 09:28 PM
libraries and linker flags icecubeflower Programming 4 09-08-2009 06:22 PM
Mesa 6.4 - Elf header, .rel.dyn: _gl_context_modes_crea and .dynsym, linker pro Yerp Linux - Software 0 05-10-2006 10:49 AM
gcc Linker error - please help! Liche Programming 5 09-26-2005 07:14 AM
Compilation flags and linker warnings alanwolfen Programming 4 02-24-2005 08:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration