0

我正在尝试应用这些补丁:

http://tehsausage.com/mingw-to-string

这样我就可以使用无论如何我都应该可以访问的 std 字符串内容。

我有 MinGW 4.7.2,起初,我尝试复制 zip 文件,但没有成功。

现在我正在尝试手动应用补丁。我将补丁信息复制到 file.patch 中,将其放在与我正在修补的文件相同的文件夹中,然后运行

patch < file.patch

然后我得到:

 patching file stdio.h
 patch unexpectedly ends in middle of line
 Hunk #1 FAILED at 574.
 patch unexpectedly ends in middle of line
 1 out of 1 hunk FAILED -- saving rejects to file stdio.h.rej
 patch unexpectedly ends in middle of line

我确保最后没有多余的空白..

请帮忙!

4

2 回答 2

1

OK, installed the latest mingw from the web-site, downloaded the patch files and made sure they were clean.

I applied each one individually, and they worked without issue. There was a warning that it was 'Stripping the trailing CRs from the file', but it worked without issue.

each patch is applied in the appropriate directory; e.g. the stdio.patch is applied to stdio.h which is in /mingw/include using:

patch </path/to/stdio.patch

ditto for wchar.patch

The os_defines.h file is found at /mingw/lib/gcc/mingw32/4.7.2/include/c++/mingw32/bits, and the patch works properly for that one as well.

I created a github with the patches at https://github.com/petesh/mingwpatches.git - you can clone the repository, or download the individual files from there. Each of them should work correctly without more than a complaint about the trailing CR warning.

于 2013-04-13T23:48:41.647 回答
0

查看补丁文件后,您可能需要使用该命令的-c选项。patchpatch表明补丁文件来自上下文差异。

例如

$ patch -c < file.patch
于 2013-04-13T18:31:20.857 回答