3 ms·
Just #include it again and it will work like expected. This preprocessor optimization is only for the case where include guards block off the entire #include f
by DSMan195276 12y ago
Just #include it again and it will work like expected.
This preprocessor optimization is only for the case where include guards block off the entire #include file. Ex:
#ifndef INCLUDE_FOO_H
#define INCLUDE_FOO_H
#endif
When the preprocessor sees that, it marks it off and never reads the file again (Unless you were to #undef INCLUDE_FOO_H, but that's an extremely unlikely scenario since it's likely to break your code). If you want to be able to include a file multiple times, just don't use include guards. Even without this optimization your idea still wouldn't work if you placed include guards in your #include file. All this does is speed up preprocessing when we already know that the file has no new lines to be added.