我開始使用Pthreads編程。我使用Dev-C++和I連接庫到項目中。簡單的程序編譯,但它不起作用。下面我附上了代碼。有誰知道有什麼問題?C中的線程簡單的示例不起作用
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <windows.h>
void *func (void* x){
printf("(%s)",'Hi. It's thread number 1');
return 1;
}
int main() {
pthread_t thread;
int x=1;
pthread_create(&thread, NULL, func, &x);
pthread_join(thread,1);
return 0;
}
你得到了什麼錯誤? – sujin
定義:***不起作用*** –
再次查看'printf'調用。 –