我编译一个小程序老是提示下面这个:
-------Configuration:hello--win32 Debug----
compiling...
hello.cpp
d:\c++专用\djmlijun1\hello.cpp(1):fatal error4 C1010:Unexpected end of file while looking for precompiled header directiveError executing C1.exe.
hello.obj -- 1 error(s),0 warning(s)
就这个错误,郁闷呢,老是通不过,多谢了!!!

解决方案 »

  1.   

    在hello.cpp中加上#include "stdafx.h"
      

  2.   

    加入#include "stdafx.h"头文件
      

  3.   

    在编译选项中将预处理头文件设置为None
      

  4.   

    大哥,你的问题应该解决了吧,
    如果在hello.cpp中加上#include "stdafx.h",
    不行的话,就是别的地方没写对,
      

  5.   

    这是我写的程序:
    #include <iostream.h>
    #include <stdAfx.h>
    int  main()
    {

    std::cout<< "Hello";
    return 0;}这是编译时的错误:
    --------------------Configuration--djmlijun2--Win32Debug--------------------
    Compiling...
    Hello2.cpp
    D:\练习c++专用\djmlijun2\Hello2.cpp(6) : error C2653: 'std' : is not a class or namespace name
    D:\练习c++专用\djmlijun2\Hello2.cpp(6) : error C2065: 'cout' : undeclared identifier
    D:\练习c++专用\djmlijun2\Hello2.cpp(6) : error C2297: '<<' : illegal, right operand has type 'char [6]'
    Error executing cl.exe.Hello2.exe - 3 error(s), 0 warning(s)你说这到低错在哪了???????????
    如果是std不能识别的话,那么怎么才能用std呢??????????
    多谢了楼上楼下!!!!
      

  6.   

    在你的文件开始的地方写上using namespace std就可以了。应该这样写
    using namespace std;
    #include <iostream>
    #include <stdAfx.h>
    int  main()
    {

    std::cout<< "Hello";
    return 0;}
      

  7.   

    #include "stdAfx.h"
    #include <iostream>
    using namespace std;int  main()
    {

    std::cout<< "Hello";
    return 0;}
      

  8.   

    using namespace std;//不用加这句也可以。
      

  9.   

    #include "stdAfx.h" 放到cpp文件第一行
      

  10.   

    菜单->Project->c/c++ ->Category ->Precompiled Headers  选择Automatic use of precompiled headers