为什么我收到错误“程序无法启动,因为您的计算机缺少 msys-2.0.dll”?有解决办法吗?

Cam*_*ace 5 c windows dll mingw

我用 C 写了一个很长的程序,所以我没有写完整的代码。这些是我使用的库(以防万一)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <time.h>
#include <sys/types.h>
#include <dirent.h>
#include "xlsxwriter.h"
Run Code Online (Sandbox Code Playgroud)

该程序在我的 Windows 计算机上完美运行,在我的工作计算机以及我有相同程序的地方运行。

但是当我在同事的计算机上运行时,会出现此错误:

System error:
The program can't start because msys-2.0.dll is missing from your computer.
Try reinstalling the program to fix this problem.
Run Code Online (Sandbox Code Playgroud)

有没有办法让它在不安装整个视觉工作室的情况下工作?

菜鸟 C 程序员在这里!:)

编辑:我是这样编译的:

gcc Example.c -o Example -static-libgcc -std=c99 -lxlsxwriter -lz
Run Code Online (Sandbox Code Playgroud)

Bas*_*tch 3

MSYS可能是一个MinGW相关的运行时库(也许是它的C标准库)。

您需要将其安装在任何执行使用 MinGW 编译的二进制文件的 Windows 计算机上。

另请参阅这个问题。

您可能想请您的同事安装MSYS2

也许还可以考虑构建一个静态链接的可执行文件(因此编译和链接-static传递给GCC)。

(这只是一个有根据的猜测;我从未使用过 Windows)