Visual c++ 错误C4716:函数:必须返回值
因此,我尝试使用Visual C++(2012)的pthread库,得到以下错误Visual c++ 错误C4716:函数:必须返回值,visual-c++,pthreads,Visual C++,Pthreads,因此,我尝试使用Visual C++(2012)的pthread库,得到以下错误错误C4716:“print_message”:必须返回一个值 这是密码 #include "stdafx.h" #include <iostream> #include "pthread.h" using namespace std; void* print_message(void *) { cout << "Threading\n"; } int main() {
错误C4716:“print_message”:必须返回一个值
这是密码
#include "stdafx.h"
#include <iostream>
#include "pthread.h"
using namespace std;
void* print_message(void *)
{
cout << "Threading\n";
}
int main()
{
pthread_t t1;
pthread_create(&t1, NULL, print_message, NULL);
cout << "Hello";
void* result;
pthread_join(t1,&result);
return 0;
}
#包括“stdafx.h”
#包括
#包括“pthread.h”
使用名称空间std;
void*打印消息(void*)
{
coutAddreturnnull;
到print\u message
。我打赌您也需要命名参数