gpt4 book ai didi

c - MinGW 编译器生成的二进制文件可以在没有 Mingw 的机器上运行吗?

转载 作者:太空宇宙 更新时间:2023-11-04 06:40:56 26 4
gpt4 key购买 nike

看我有这样的代码

#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 的其他 Windows 机器上运行它的二进制文件时,它没有运行..说 cygwin.dll 缺少类似错误的东西

最佳答案

如果我没记错的话,它应该只依赖于 Microsoft CRT(msvcrt.dll,可能是 Windows 上可用的最旧版本之一)和其他系统标准 dll(kernel32.dll 等),但您可以轻松检查用 Dependency Walker 检查你的可执行文件.

关于c - MinGW 编译器生成的二进制文件可以在没有 Mingw 的机器上运行吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8329903/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com