看到我有这样的代码由MinGW编译器生成的二进制文件将在没有Mingw的机器上运行?
#include<stdio.h>
#include<pthread.h>
#include<string.h>
void* thread_function(void)
{
printf ("This is thread %d \n",pthread_self())
}
int main(int argc,char *argv[])
{
pthread_t thread_id[argc-1];
int i;
int status;
printf("argc is %d ",argc-1);
for(i=0;i<argc-1;i++)
{
pthread_create (&thread_id[i], NULL , &thread_function, NULL);
}
for(i=0;i<argc-1;i++)
pthread_join(thread_id[i],NULL);
}
现在我已经MinGW的编译器gcc.exe 4.6.1编译它,并得到A.EXE现在我要问你这是否会A.EXE上工作其他Windows机器MinGW没有安装?
编辑: 当我编译通过Cygwin的编译器代码并没有在cygwin运行其上的其他窗口机二进制它不run..says cygwin.dll缺少类似的东西,错误出现
您可能会遇到pthreads问题...请参阅http://stackoverflow.com/questions/5057192/threaded-c-programs-in-mingw –