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.

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.

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

C++C++11C++14C++17C++20Introduction to C++Learn C++

How To Learn The Move Constructors In Modern C++?

C++C++17Code SnippetLearn C++

How To Convert Char Array String To Unicode String Correctly In C++?

Artificial Intelligence TechC++Language FeatureLearn C++

How To Develop A Simple Hopfield Network In C++