- 论坛徽章:
- 0
|
#include <iostream.h>
#include <windows.h>
#include "stdafx.h"
DWORD WINAPI ThreadProc(LPVOID lpParameter)
{
cout<<"我是子线程"<<endl;
return 0;
}
void main ()
{
HANDLE hThread;
hThread=CreateThread(NULL,NULL,ThreadProc,NULL,NULL,NULL);
WaitForSingleObject(hThread,INFINITE);
cout<<"我是主线程"<<endl;
}
为什么我运行上面的程序之后,会出错,下面是LOG,求高人解答(WindowsXP 下的VC):
Compiling...
fff.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\fff\fff.cpp(4) : error C2146: syntax error : missing ';' before identifier 'WINAPI'
C:\Program Files\Microsoft Visual Studio\MyProjects\fff\fff.cpp(4) : error C2501: 'DWORD' : missing storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\fff\fff.cpp(4) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
fff.obj - 3 error(s), 0 warning(s) |
|