#Include directive: the difference between "test.h" and "./test.h"

Is there a difference between #include "./test.h"and #include "test.h"for the C / C ++ preprocessor?

+3
source share
4 answers

No, no difference.

You can also have

#include "../thisdir/test.h"

And it will be the same

+4
source

According to the C standard, there is no difference: the compiler gets an indication of how to look for them. In practice, there should be no difference for any of the implementations that I know of.

+1
source

.

#include "test.h"

include . (, -I GCC). . .

+1

-, .

In the case, the #include "test.h"search for the include file is performed in all directories specified in the compiler with the -I option.

In the case #include "./test.h", only the resident directory of the link file is used.

-1
source

Source: https://habr.com/ru/post/1720771/


All Articles