#include and Visual Studio unable to compile

I recently saw #include including every standard library and stdc include file. When I try to compile the following code snippet using visual studio 2013, it will give Error C1083: Cannot open include file:’bits/stdc.h’: No such file or directory. But it works perfectly with codeblocks. Is there any way to avoid this error?

#include 

using namespace std;

int main()
{

}

I saw in some posts that’Header files are not part of the C standard and therefore are not portable’ and should be avoided’. But I Think it is useful in game programming.

Is there any way to avoid this error?

Yes: Do not use non-standard header files provided only by GCC, not Microsoft’s compiler.

The C standard requires every compiler Many headers are provided, such as and . However, the implementation of these headers by a specific compiler may depend on other non-standard headers that come with that compiler, and is one of them. /p>

Treat standard headers (such as ) as a “public” interface, and treat compiler-specific content (such as everything in bit/) as a “private” implementation. If you want the program to be portable To other compilers-or even future versions of the same compiler, you should not rely on compiler-specific implementation details.

If you want a header that includes all standard headers, then write your own header It’s easy.

I recently saw #include including every standard library and stl include files. When I try to compile the following using visual studio 2013 When code snippet, it will give error C1083: Cannot open include file:’bits/stdc.h’: No such file or directory. But it works perfectly with codeblocks. Is there any way to avoid this error?

#include 

using namespace std;

int main()
{

}

I saw in some posts that’Header files are not part of the C standard and therefore are not portable’ and should be avoided’. But I Think it is useful in game programming.

Is there any way to avoid this error?

Yes: Do not use non-standard header files provided only by GCC, not Microsoft’s compiler.

The C standard requires each compiler to provide many headers, such as and . But the specific compiler’s implementation of these headers may depend on other non-standard headers attached to the compiler, and is one of them.

The standard headers (e.g. < iostream>) as a “public” interface, and compiler-specific content (such as everything in bit/) as a “private” implementation. If you want the program to be portable to other compilers-or even the same compiler In future versions, you should not rely on compiler-specific implementation details.

If you want a header that includes all standard headers, it is easy to write your own header.

< p>

Leave a Comment

Your email address will not be published.