如何install/apply C++补丁?

How to install/apply C++ patch?

我正在尝试在我的计算机上编译一个旧的遗留项目。我卡在 #error "Threading support unavailable: it has been explicitly disabled with BOOST_DISABLE_THREADS 上,偶然发现了一个补丁。参见 this question。我下载了补丁文件

我应该用它做什么?我该如何安装它?将其放入指定文件夹 (...\boost_1_48_0\boost\config\stdlib) 没有帮助。

我正在使用 boost 1.48; CodeBlocks IDE 和 cygwin on Windows 10.

补丁看起来像这样:

Index: boost/config/stdlib/libstdcpp3.hpp
===================================================================
--- boost/config/stdlib/libstdcpp3.hpp  (revision 75635)
+++ boost/config/stdlib/libstdcpp3.hpp  (working copy)
@@ -33,7 +33,8 @@
 
 #ifdef __GLIBCXX__ // gcc 3.4 and greater:
 #  if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
-        || defined(_GLIBCXX__PTHREADS)
+        || defined(_GLIBCXX__PTHREADS) \
+        || defined(_GLIBCXX_HAS_GTHREADS)
       //
       // If the std lib has thread support turned on, then turn it on in Boost
       // as well.  We do this because some gcc-3.4 std lib headers define _REENTANT

假设你把补丁放在 boost_1_48_0/threads.patch 下,你应该可以用

应用它
cd ...\boost_1_48_0
patch -p0 < threads.patch

之后您可以删除补丁文件。