What is the difference between #include <filename> and #include "filename" in C++?
Hello colleagues! I'm a beginner C++ developer and I've encountered something unclear. In textbooks and code examples, I see two ways to include header files:
1. `#include ` — with angle brackets.
2. `#include "myheader.h"` — with quotes.
At first glance, there's no difference — both options include a file. But I noticed that standard libraries (iostream, vector, string) are always written with angle brackets, while my own files (e.g., "myclass.h") are written with quotes.
I tried writing `#include "iostream"` — the code compiled and worked. But `#include ` gave an error "file not found". Why does this happen? Is it just a style convention or is there a real technical difference?
I'm particularly interested in:
- How does the compiler search for files in each case?
- In
No answers yet.
Log in to leave an answer