diff --git a/etc/config/settings.sh b/etc/config/settings.sh
index dc39c480e1f09433e083ef98e0987b0825536915..0b12e4e453881a79484bfd374b58bc64709e51b5 100644
--- a/etc/config/settings.sh
+++ b/etc/config/settings.sh
@@ -233,7 +233,13 @@ case "${foamCompiler}" in
 OpenFOAM | ThirdParty)
     case "$WM_COMPILER" in
     Gcc | Gcc++0x | Gcc46 | Gcc46++0x)
-        gcc_version=gcc-4.6.2
+        gcc_version=gcc-4.6.1
+        gmp_version=gmp-5.0.4
+        mpfr_version=mpfr-3.1.0
+        mpc_version=mpc-0.9
+        ;;
+    Gcc47 | Gcc47++0x)
+        gcc_version=gcc-4.7.0
         gmp_version=gmp-5.0.4
         mpfr_version=mpfr-3.1.0
         mpc_version=mpc-0.9
diff --git a/src/OSspecific/POSIX/fileMonitor.C b/src/OSspecific/POSIX/fileMonitor.C
index 31a734740d0fb814dfc0971dfd6bc99f865637e4..030e7639f4b69d3e3b6ce60104efb46cec6fb4ce 100644
--- a/src/OSspecific/POSIX/fileMonitor.C
+++ b/src/OSspecific/POSIX/fileMonitor.C
@@ -32,6 +32,7 @@ License
 #include "regIOobject.H"     // for fileModificationSkew symbol
 
 #ifdef FOAM_USE_INOTIFY
+#   include <unistd.h>
 #   include <sys/inotify.h>
 #   include <sys/ioctl.h>
 #   include <errno.h>
diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C
index 56ff3675e5b9ecfb09a2eff45344462679516c3b..9cfff0d1a3240dfa978939fd1a7dc9c76185d3bb 100644
--- a/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C
+++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/SmoothSolver/SmoothSolver.C
@@ -53,7 +53,7 @@ template<class Type, class DType, class LUType>
 void Foam::SmoothSolver<Type, DType, LUType>::readControls()
 {
     LduMatrix<Type, DType, LUType>::solver::readControls();
-    readControl(this->controlDict_, nSweeps_, "nSweeps");
+    this->readControl(this->controlDict_, nSweeps_, "nSweeps");
 }
 
 
diff --git a/wmake/rules/linux64Gcc47/c b/wmake/rules/linux64Gcc47/c
new file mode 100644
index 0000000000000000000000000000000000000000..f4114be3143d1210ffea500a2b361008910abed0
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/c
@@ -0,0 +1,16 @@
+.SUFFIXES: .c .h
+
+cWARN        = -Wall
+
+cc          = gcc -m64
+
+include $(RULES)/c$(WM_COMPILE_OPTION)
+
+cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
+
+ctoo        = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $$SOURCE -o $@
+
+LINK_LIBS   = $(cDBUG)
+
+LINKLIBSO   = $(cc) -shared
+LINKEXE     = $(cc) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
diff --git a/wmake/rules/linux64Gcc47/c++ b/wmake/rules/linux64Gcc47/c++
new file mode 100644
index 0000000000000000000000000000000000000000..98b25ed1fea2a1baa0ad749c09a76bd877ea4a6d
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/c++
@@ -0,0 +1,21 @@
+.SUFFIXES: .C .cxx .cc .cpp
+
+c++WARN     = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
+
+CC          = g++ -m64
+
+include $(RULES)/c++$(WM_COMPILE_OPTION)
+
+ptFLAGS     = -DNoRepository -ftemplate-depth-100
+
+c++FLAGS    = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC
+
+Ctoo        = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $$SOURCE -o $@
+cxxtoo      = $(Ctoo)
+cctoo       = $(Ctoo)
+cpptoo      = $(Ctoo)
+
+LINK_LIBS   = $(c++DBUG)
+
+LINKLIBSO   = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
+LINKEXE     = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
diff --git a/wmake/rules/linux64Gcc47/c++Debug b/wmake/rules/linux64Gcc47/c++Debug
new file mode 100644
index 0000000000000000000000000000000000000000..19bdb9c3346fc7a69380dfedd6e7911fe220a965
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/c++Debug
@@ -0,0 +1,2 @@
+c++DBUG    = -ggdb3 -DFULLDEBUG
+c++OPT      = -O0 -fdefault-inline
diff --git a/wmake/rules/linux64Gcc47/c++Opt b/wmake/rules/linux64Gcc47/c++Opt
new file mode 100644
index 0000000000000000000000000000000000000000..3446f7f58cbeb23e1753e982a9734bbf1a180b43
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/c++Opt
@@ -0,0 +1,4 @@
+c++DBUG     =
+c++OPT      = -O3
+#c++OPT      = -march=nocona -O3
+# -ftree-vectorize -ftree-vectorizer-verbose=3
diff --git a/wmake/rules/linux64Gcc47/c++Prof b/wmake/rules/linux64Gcc47/c++Prof
new file mode 100644
index 0000000000000000000000000000000000000000..3bda4dad55e898a8198f6e8bfe21e8d829d7230a
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/c++Prof
@@ -0,0 +1,2 @@
+c++DBUG    = -pg
+c++OPT     = -O2
diff --git a/wmake/rules/linux64Gcc47/cDebug b/wmake/rules/linux64Gcc47/cDebug
new file mode 100644
index 0000000000000000000000000000000000000000..72b638f458220e329d52b59e3566a3c807101f9d
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/cDebug
@@ -0,0 +1,2 @@
+cDBUG       = -ggdb -DFULLDEBUG
+cOPT        = -O1 -fdefault-inline -finline-functions
diff --git a/wmake/rules/linux64Gcc47/cOpt b/wmake/rules/linux64Gcc47/cOpt
new file mode 100644
index 0000000000000000000000000000000000000000..17318709f1fa39e6bf89cbe87778bc6fa459de17
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/cOpt
@@ -0,0 +1,2 @@
+cDBUG       =
+cOPT        = -O3
diff --git a/wmake/rules/linux64Gcc47/cProf b/wmake/rules/linux64Gcc47/cProf
new file mode 100644
index 0000000000000000000000000000000000000000..ca3ac9bf5f0cd61fe99e0f05fa1bd4bdf9fa6cf7
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/cProf
@@ -0,0 +1,2 @@
+cDBUG       = -pg
+cOPT        = -O2
diff --git a/wmake/rules/linux64Gcc47/general b/wmake/rules/linux64Gcc47/general
new file mode 100644
index 0000000000000000000000000000000000000000..4a42b11b1ee6aebe596e3cd2e2633d9c70cb5e9a
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/general
@@ -0,0 +1,8 @@
+CPP        = cpp -traditional-cpp
+
+PROJECT_LIBS = -l$(WM_PROJECT) -ldl
+
+include $(GENERAL_RULES)/standard
+
+include $(RULES)/c
+include $(RULES)/c++
diff --git a/wmake/rules/linux64Gcc47/mplibHPMPI b/wmake/rules/linux64Gcc47/mplibHPMPI
new file mode 100644
index 0000000000000000000000000000000000000000..574492a236a32f7d87d00bf0e3507a5ac8e54f55
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/mplibHPMPI
@@ -0,0 +1,3 @@
+PFLAGS     =
+PINC       = -I$(MPI_ARCH_PATH)/include -D_MPICC_H
+PLIBS      = -L$(MPI_ARCH_PATH)/lib/linux_amd64 -lmpi
diff --git a/wmake/rules/linux64Gcc47/mplibINTELMPI b/wmake/rules/linux64Gcc47/mplibINTELMPI
new file mode 100644
index 0000000000000000000000000000000000000000..cf80ec2eaf68d1c2f6adf208964b6490c4c8fd36
--- /dev/null
+++ b/wmake/rules/linux64Gcc47/mplibINTELMPI
@@ -0,0 +1,3 @@
+PFLAGS     = -DMPICH_SKIP_MPICXX
+PINC       = -I$(MPI_ARCH_PATH)/include64
+PLIBS      = -L$(MPI_ARCH_PATH)/lib64 -lmpi