#include <windows.h>int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,                   PSTR szCmdLine, int iCmdShow){MessageBox (NULL, TEXT ("Hello, Windows 98!"), TEXT ("HelloMsg"), 0);return 0 ;}
--------------------Configuration: 3 - Win32 Debug--------------------
Compiling...
33.cpp
c:\program files\microsoft visual studio\myprojects\3\33.cpp(13) : fatal error C1010: unexpected end of file while looking for precompiled header directive
执行 cl.exe 时出错.33.obj - 1 error(s), 0 warning(s)

解决方案 »

  1.   

    在最前面加上
    #include "stdafx.h"
      

  2.   

    标题很奇怪,除了你包含过这个头文件,这个编译错误哪儿显示和windows.h有关?
      

  3.   

    第一种方法: 加上  #include "stdafx.h"
    第二种方法:  工程设置->c/c++选项卡->预编译的头文件,选择不使用
      

  4.   

    编译解决了,但是连接不成功,我想写个windows下的hello,world怎么那么难啊,帖子加分了,望高人解决,水贴就免了,不会给分的
    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/1.exe : fatal error LNK1120: 1 unresolved externals
    执行 link.exe 时出错.1.exe - 1 error(s), 0 warning(s)
      

  5.   

    你创建的是控制台项目,应该创建Win32项目,不过可以把
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
    改成int main()
      

  6.   

    如果不行再改成extern "C" int main()试试。
      

  7.   

    你使用的是vs几啊?
    不要用开发环境,把上面的保存为hello.c,然后在命令行里执行cl hello.c就能成功了(环境变量要配置正确)!
    肯定是你的开发环境设置有问题。
      

  8.   

    console程序吧?建个win32的,然后拷过去
      

  9.   

    你创建项目的时候选择Win32应用程序,在下一页面再选择一个简单的应用程序,创建之后会生成WinMain函数,你再把自己的代码加进去就可以了。