Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6130741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:53:38+00:00 2026-05-23T16:53:38+00:00

When I compile a very simple source file with gcc I don’t have to

  • 0

When I compile a very simple source file with gcc I don’t have to specify the path to standard include files such as stdio or stdlib.

How does GCC know how to find these files?

Does it have the /usr/include path hardwired inside, or it will get the paths from other OS components?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:53:38+00:00Added an answer on May 23, 2026 at 4:53 pm

    In order to figure out the default paths used by gcc/g++, as well as their priorities, you need to examine the output of the following commands:

    1. For C:
    echo | gcc -xc -E -v -
    
    1. For C++:
    echo | gcc -xc++ -E -v -
    

    The credit goes to Qt Creator team.

    Here’s a breakdown of the flags:

    • -x selects the language, C or C++ respectively

    • -E makes gcc to run the preprocessor only, so no compilation takes place

    • -v prints all the commands run, which is the key to dumping the standard paths

    • - is the "input file" to preprocess, as a convention - stands for stdin (or stdout, depending on the context);

      echo | feeds an empty string to gcc so effectively we preprocess an empty file generated on the fly

    Here’s a nice explaining it in more detail: https://explainshell.com/explain?cmd=echo+%7C+gcc+-xc+-E+-v+-

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple C program (one source file) which I want to compile
I am trying to compile the following very very simple piece of source code:
i am trying to compile this very simple piece of code class myList {
I have a very big constant array that is initialized at compile time. typedef
I have a very simple agent, basically just the required Agent_OnLoad method signature. If
I have a problem with a simple included file. The file being included is
I'm trying to compile a very simple program in Java 1.6 on Ubuntu Jaunty,
This should be very simple question. There are many programming languages out there, compiled
We are getting very slow compile times, which can take upwards of 20+ minutes
I'm trying to compile/link a very old piece of software on a linux system

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.