#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)
--------------------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)
#include "stdafx.h"
第二种方法: 工程设置->c/c++选项卡->预编译的头文件,选择不使用
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)
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
改成int main()
不要用开发环境,把上面的保存为hello.c,然后在命令行里执行cl hello.c就能成功了(环境变量要配置正确)!
肯定是你的开发环境设置有问题。