C++入门选手,学习线程时写了一小段代码,如下
```#include "stdafx.h"
#include
#include
using namespace std;
DWORD WINAPI Fun1(LPVOID lpParamter)
{
char* buf = (char *)lpParamter;
cout << int(buf) << endl;
Sleep(1000);
}
int main()
{
HANDLE hThread[2];
for (int i = 0; i < 2; i++) {
hThread[i] = CreateThread(NULL, 0, Fun1, (LPVOID)i, 0, NULL);
}
cout << "3" << endl;
Sleep(5000);
for (int i = 0; i < 2; i++) {
TerminateProcess(hThread[i],0);
CloseHandle(hThread[i]);
}
return 0;
}
在VS2015编译时报错,说“Fun1”: 必须返回一个值, 请问各位大神这是什么意思?我这程序应该怎么改?