locked
ERROR: Use of C runtime library internal header file RRS feed

  • Question

  • hello
    i use visual c++ 2008,i tried to build this:

    #include<stdio.h>

    #include<stdafx.h>

    int

    main(void)

    {

    printf("Hello, world\n");

     return 0;

    }

    at first i got this error:

    fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory


    i went to:project..properties..C/C++..General..Additional Include directories  and browsed this address in the empty field:"D:\Program Files\Microsoft Visual Studio 9.0\VC\crt\src"
    then when i again tried to build it gave me this error:

     

     

     

    d:\program files\microsoft visual studio 9.0\vc\crt\src\crtdefs.h(36) : fatal error C1189: #error : ERROR: Use of C runtime library internal header file. 

    any ideas how should i fix this error?
    thanks

    Wednesday, April 8, 2009 5:30 PM

Answers


  • Quote>#include<stdio.h>
    Quote>#include<stdafx.h>

    The stdafx.h include statement should always be the first
    in the series of includes:

    #include<stdafx.h>
    #include<stdio.h>

    - Wayne
     

    • Marked as answer by nobugz Wednesday, April 8, 2009 10:47 PM
    Wednesday, April 8, 2009 10:35 PM

All replies

  • You cannot add that path to the includes.  Use vc\include instead.  You'd better check if that directory is still there and contains stdio.h.  If not, you've got some kind of nasty disk damage.
    Hans Passant.
    Wednesday, April 8, 2009 6:37 PM
  • thanks for reply,i checked vc\include  and stdio.h didn't exist there,i went to:project..properties..C/C++/..preprocessor and added _CRTBLD to preprocessor definitions and this error ( Use of C runtime library internal header file.  
    )
    was gone,but it gave me another error:

    fatal error C1083: Cannot open include file: 'codeanalysis\sourceannotations.h': No such file or directory

    i don't know why these sequence of errors happen,in visual studio 2005 i had none of these problems,
    you mean from "disk damage" i should reinstall C++?
    Wednesday, April 8, 2009 7:13 PM
  • If you just recently installed VS, a reinstall might work.  If not, go ahead and panic.  Then quickly save anything off the drive for which you don't have a good backup.
    Hans Passant.
    Wednesday, April 8, 2009 7:17 PM

  • Quote>#include<stdio.h>
    Quote>#include<stdafx.h>

    The stdafx.h include statement should always be the first
    in the series of includes:

    #include<stdafx.h>
    #include<stdio.h>

    - Wayne
     

    • Marked as answer by nobugz Wednesday, April 8, 2009 10:47 PM
    Wednesday, April 8, 2009 10:35 PM

  • Also, you should use quotes, not angle brackets, with stdafx.h:

    #include "stdafx.h"

    - Wayne

    [First time I edited somebody's post, hope it's okay]

    [[ Yes, thanks. - WayneAKing]]


    • Edited by nobugz Wednesday, April 8, 2009 10:50 PM commas = quotes
    • Edited by WayneAKing Wednesday, April 8, 2009 10:55 PM "quotes" not "commas"
    Wednesday, April 8, 2009 10:41 PM