C++Learn C++

What is The Difference Between #include <...> And #include “…”?

What is the difference between #include <…> and #include “…”? What does #include “filename” mean for a C++ compiler? What does <filename> means for a C++ IDE? How can I use include? How can I add header paths into #include <> usage? Let’s answer these questions!

What does #include “filename” mean?

In general, in C++ if a filename is declared between ” ” it means it is pointing to an exact file location. In other words, the #include “filename” line means the #include preprocessor searches for that exact full path or file in that directory path as the file containing the directive. If the programmer has some specific headers this method is used to include these headers containing other definitions, included headers, classes, methods, and variables.

For example, for 32bits applications, an iostream can be included as below,

and for a 64bits application you need 64bit version of iostream, it can be included as below,

What does #include <filename> mean?

If #include preprocessor uses filename between ‘<‘ and ‘>’ that generally points a file which can be found in the default paths of that C++ compiler or C++ IDE. This is used to include standard library header files. In other words, the #include <filename> line means the #include preprocessor searches in an implementation-dependent manner, normally in search directories pre-designated by the compiler/IDE.

This makes for a more friendly usage than the two preceding examples. The compiler includes appropriate header folders depending on the platform and whether it is a 32bit or 64bit version.

What is the difference between #include <…> and #include “…”?

The two sections above are probably enough to explain the main difference, as you can see the difference is in the location where the preprocessor searches for the included file.

How can I add header paths into #include <…> usage?

Assuming you would like to use the #include <filename> method, but you don’t know how to add some new headers in your specific folders to your C++ projects? In C++ Builder there is a “C++ Compiler Directories and Conditionals” option. You can add your specific directory paths for the specific platform settings. To do this, do the following;

1. Go to Project -> Options … menu in RAD Studio or C++ Builder. There is a Directories and Conditionals section in the Building->C++ Compiler section.

2. On the right side, there is a “…” ellipse button at the end of the Include file search path section,

3. if you select this there will be an Include file search path window, you can add your folders by using the yellow folder icon (or you can directly type it in), then press “Add” button.

What is The Difference Between #include <...> And #include "..."? The directories and conditionals dialog.

4. Then press OK and Save ..

These options will be recorded in the project file and saved along with it.

A more complete description can be found in the Embarcadero’s Doc Wiki here, and in the GCC documentation on search paths here.

C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise versions of C++ Builder and there is a trial version you can download from here.

close

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

33+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux and some other operating systems. Dr. Yilmaz Yoru was born in 1974, Eskisehir-Turkey. He graduated from the department of Mechanical Engineering of Eskisehir Osmangazi University in 1997. One year later he started to work in the same university as an assistant. He received his MSc and PhD degrees from the same department of the same university. He has married and he is a father of a son. Some of his interests are Programming, Thermodynamics, Fluid Mechanics and Artificial Intelligence. He also likes the graphical 2D & 3D design and high-end innovations.
Related posts
CC++Introduction to C++Learn C++

Who Wrote The C Programming Language?

CC++Introduction to C++Language FeatureLearn C++

Is C A High Level Programming Language?

CC++Introduction to C++Learn C++

How To Run A C Program in Command Prompt

CC++C++17Learn C++

How To Compile And Run A C Program