I know that inlcude_next is an extension of the GNU C preprocessor. I ran into the problem of compiling Gnu library code using MSVC. For example, there is a header file stdio.h or rather GNU-like <stdio.h> . When compiled using the MS compiler, I get an invalid preprocessor command 'include_next' , which is fine because there is nothing like the #include_next directive for windows. The main purpose of creating #include_next is that you would like to create the stdio.h file in your project, and this will be included instead of the default header.
So, I tried 2 options: 1) Comment on this line // #include_next <stdio.h> in all files. 2) Or replace #include_next with #include <stdio.h> .
I don't know if the choice 1) will cause any problems (linker errors at the end). As for 2), I got fatal error C1014: too many include files : depth = 1024 , which is fine too. For this, I would use wrapper #ifndef for security guards included or the # pragma once directive.
The following are my concerns:
Do I need to write instructions like #include <stdio> or #include "stdio.h" inside the stdio.h header file? Will this make sense when compiling for Windows. Isnβt it enough for me to simply #include "stdio.h" directly in all the source files where it is needed, so that it bypasses the standard Visual C header and uses mine, rather? And what can / cannot happen if I omit the whole include_next statement?
My main goal is to successfully compile gnu libraries using MSVC. Please correct me if I missed something or perhaps shed light on this topic.
source share