diff --git a/indra/llcharacter/llkeyframemotion.h b/indra/llcharacter/llkeyframemotion.h
index 7e8c84488c087017697bd640f07be3827c503204..50d9d0504616ed9ab5237f7f89d0fd761525cf5d 100644
--- a/indra/llcharacter/llkeyframemotion.h
+++ b/indra/llcharacter/llkeyframemotion.h
@@ -47,7 +47,6 @@
 #include "llquaternion.h"
 #include "v3dmath.h"
 #include "v3math.h"
-#include "llapr.h"
 #include "llbvhconsts.h"
 
 class LLKeyframeDataCache;
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index 1a052ce62d6c316722e6fbda471f7c03aa2427de..72b81f382cc9c234f1721b7cd323e8acc6813233 100644
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -34,7 +34,6 @@
 #define LL_LLAPP_H
 
 #include <map>
-#include "llapr.h"
 #include "llrun.h"
 #include "llsd.h"
 #include "lloptioninterface.h"
@@ -202,8 +201,6 @@ public:
 #if !LL_WINDOWS
 	static U32  getSigChildCount();
 	static void incSigChildCount();
-#else
-#define getpid GetCurrentProcessId
 #endif
 	static int getPid();
 
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index b08bb617c5778bffe706e8a54b0bfcdb5e10bab4..b05a222b33380e83a8e2452824fe6ddb7afcf106 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -38,6 +38,14 @@
 #if LL_LINUX || LL_SOLARIS
 #include <sys/param.h>  // Need PATH_MAX in APR headers...
 #endif
+#if LL_WINDOWS
+	// Limit Windows API to small and manageable set.
+	// If you get undefined symbols, find the appropriate
+	// Windows header file and include that in your .cpp file.
+	#define WIN32_LEAN_AND_MEAN
+	#include <winsock2.h>
+	#include <windows.h>
+#endif
 
 #include <boost/noncopyable.hpp>
 
diff --git a/indra/llcommon/llcommon.h b/indra/llcommon/llcommon.h
index b36471f9f81cac843b35140ab7df4d1c0dd1c0f5..05eef25b21657a5eaf0f29bae4f6b5c5e56b4fb5 100644
--- a/indra/llcommon/llcommon.h
+++ b/indra/llcommon/llcommon.h
@@ -33,7 +33,6 @@
 #define LL_COMMON_H
 
 // *TODO: remove these?
-#include "llapr.h"
 #include "lltimer.h"
 #include "llfile.h"
 
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 77c0c2294a46f4e673981815bdcdb4bd54e56b85..bd334a66548ab379a22e86c73843ca1be9069d89 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -45,9 +45,6 @@
 # include <syslog.h>
 # include <unistd.h>
 #endif // !LL_WINDOWS
-#if LL_WINDOWS
-# include <windows.h>
-#endif // LL_WINDOWS
 #include <vector>
 
 #include "llapp.h"
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h
index d8aa90de2e8a1e876de3719893431968e3ee003c..adef1a91926609acc3ad75878afb485ec27093ee 100644
--- a/indra/llcommon/llthread.h
+++ b/indra/llcommon/llthread.h
@@ -34,6 +34,7 @@
 #define LL_LLTHREAD_H
 
 #include "llapp.h"
+#include "llapr.h"
 #include "apr_thread_cond.h"
 
 class LLThread;
diff --git a/indra/llmessage/lliohttpserver.h b/indra/llmessage/lliohttpserver.h
index d1c9bdde856756238f5863b6eaa251485ba4783e..e8e390f296ec83a190e5642b980ab600b10ab44e 100644
--- a/indra/llmessage/lliohttpserver.h
+++ b/indra/llmessage/lliohttpserver.h
@@ -34,7 +34,6 @@
 #ifndef LL_LLIOHTTPSERVER_H
 #define LL_LLIOHTTPSERVER_H
 
-#include "llapr.h"
 #include "llchainio.h"
 #include "llhttpnode.h"
 
diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h
index 25669f5d78eddb2d9a100809bb5558b30bee8a89..17608063b52cc57a2487acd4dd2fb17821937e0c 100644
--- a/indra/llplugin/llpluginprocessparent.h
+++ b/indra/llplugin/llpluginprocessparent.h
@@ -34,6 +34,7 @@
 #ifndef LL_LLPLUGINPROCESSPARENT_H
 #define LL_LLPLUGINPROCESSPARENT_H
 
+#include "llapr.h"
 #include "llprocesslauncher.h"
 #include "llpluginmessage.h"
 #include "llpluginmessagepipe.h"
diff --git a/indra/llvfs/llpidlock.cpp b/indra/llvfs/llpidlock.cpp
index 315baa001d2a6a0c01596ac6e7d1a8e1e062af90..95e3692e1074513f34515996ac10cc3f65eae087 100755
--- a/indra/llvfs/llpidlock.cpp
+++ b/indra/llvfs/llpidlock.cpp
@@ -41,6 +41,15 @@
 #include "llframetimer.h"
 
 #if LL_WINDOWS   //For windows platform.
+
+#include <windows.h>
+
+namespace {
+	inline DWORD getpid() {
+		return GetCurrentProcessId();
+	}
+}
+
 bool isProcessAlive(U32 pid)
 {
 	return (bool) GetProcessVersion((DWORD)pid);
diff --git a/indra/llvfs/llpidlock.h b/indra/llvfs/llpidlock.h
index 42aee4dc4fc4edcc092895f405ab0007b12f75a9..496e99cf5a5d3042b3b6051d651040b9878b88cc 100755
--- a/indra/llvfs/llpidlock.h
+++ b/indra/llvfs/llpidlock.h
@@ -37,17 +37,9 @@
 class LLSD;
 class LLFrameTimer;
 
-#if LL_WINDOWS	//For windows platform.
-
-#include <windows.h>
-
-#define getpid GetCurrentProcessId
-
-#else	//Everyone Else
-
+#if !LL_WINDOWS	//For non-windows platforms.
 #include <signal.h>
-
-#endif //Everyone else.
+#endif
 
 namespace LLPidLock
 {
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index eb08707b61320f0396143c6e1c9c56c12d39f80f..79372b593ab6636bebaf81ee6b399a5395b42414 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -83,11 +83,14 @@
 #include "llsecondlifeurls.h"
 
 // Linden library includes
+#include "llimagej2c.h"
 #include "llmemory.h"
 #include "llprimitive.h"
 #include "llurlaction.h"
+#include "llvfile.h"
 #include "llvfsthread.h"
 #include "llvolumemgr.h"
+#include "llxfermanager.h"
 
 #include "llnotificationmanager.h"
 #include "llnotifications.h"
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index c1bfbca8686c2f778c08fc13ef64ed3eb1790966..40e74061b541386c4d35f20b693fc542d4f865a5 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -325,6 +325,7 @@ extern BOOL		gUseWireframe;
 // VFS globals - gVFS is for general use
 // gStaticVFS is read-only and is shipped w/ the viewer
 // it has pre-cache data like the UI .TGAs
+class LLVFS;
 extern LLVFS	*gStaticVFS;
 
 extern LLMemoryInfo gSysMemory;
diff --git a/indra/newview/llfloateranimpreview.h b/indra/newview/llfloateranimpreview.h
index f1c4a6b0d08cdbd34dfa245689228df9e1d78c8d..2bf81476a2cf148e9a57fcf3a4aa8117c0b10cc3 100644
--- a/indra/newview/llfloateranimpreview.h
+++ b/indra/newview/llfloateranimpreview.h
@@ -33,6 +33,7 @@
 #ifndef LL_LLFLOATERANIMPREVIEW_H
 #define LL_LLFLOATERANIMPREVIEW_H
 
+#include "llassettype.h"
 #include "llfloaternamedesc.h"
 #include "lldynamictexture.h"
 #include "llcharacter.h"
diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp
index b63bcccf6bf2ac07f7ad67b8c2a05ab8b5237617..bbccbb87090f31239c25a7b56b89d5a564730402 100644
--- a/indra/newview/llfloaterauction.cpp
+++ b/indra/newview/llfloaterauction.cpp
@@ -35,7 +35,6 @@
 #include "llfloaterauction.h"
 #include "llfloaterregioninfo.h"
 
-#include "lldir.h"
 #include "llgl.h"
 #include "llimagej2c.h"
 #include "llimagetga.h"
@@ -43,6 +42,7 @@
 #include "llvfile.h"
 #include "llvfs.h"
 #include "llwindow.h"
+#include "message.h"
 
 #include "llagent.h"
 #include "llcombobox.h"
diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp
index 68f06b1e5b591231bdb5b8392c7232b06e6eb714..e925796526e75ef38c7e52f8160aa25280620cb8 100644
--- a/indra/newview/llfloaterbump.cpp
+++ b/indra/newview/llfloaterbump.cpp
@@ -33,11 +33,11 @@
  
 #include "llviewerprecompiledheaders.h"
 
-#include "llfloaterbump.h"
+#include "llsd.h"
+#include "mean_collision_data.h"
 
+#include "llfloaterbump.h"
 #include "llscrolllistctrl.h"
-
-#include "llsd.h"
 #include "lluictrlfactory.h"
 #include "llviewermessage.h"
 
diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp
index 572eeb57fee969ef394b325a26a474f087470fab..8da44e203509428171ea76b7bfe7ab31257e6f7a 100644
--- a/indra/newview/llfloaterpostcard.cpp
+++ b/indra/newview/llfloaterpostcard.cpp
@@ -56,9 +56,8 @@
 #include "llstatusbar.h"
 #include "llviewerregion.h"
 #include "lleconomy.h"
+#include "message.h"
 
-#include "llgl.h"
-#include "llglheaders.h"
 #include "llimagejpeg.h"
 #include "llimagej2c.h"
 #include "llvfile.h"
diff --git a/indra/newview/llfloaterpostcard.h b/indra/newview/llfloaterpostcard.h
index 49cce5310613c7d0823c4c0c2d48acd200e85aab..0a44b507797fab2ff93ed9cdf7bacd0a8955da26 100644
--- a/indra/newview/llfloaterpostcard.h
+++ b/indra/newview/llfloaterpostcard.h
@@ -70,7 +70,7 @@ public:
 
 	void sendPostcard();
 
-protected:
+private:
 	
 	LLPointer<LLImageJPEG> mJPEGImage;
 	LLPointer<LLViewerTexture> mViewerImage;
@@ -78,7 +78,7 @@ protected:
 	LLAssetID mAssetID;
 	LLVector2 mImageScale;
 	LLVector3d mPosTakenGlobal;
-	boolean mHasFirstMsgFocus;
+	bool mHasFirstMsgFocus;
 };
 
 
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 05a46ad89451e4b40a34d1acffe2f0bbeb048fe5..00c46666f672d0d7a3ef98abeea4be9309255f73 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -42,6 +42,8 @@
 #include "llglheaders.h"
 #include "llregionflags.h"
 #include "llstl.h"
+#include "llvfile.h"
+#include "llxfermanager.h"
 #include "indra_constants.h"
 #include "message.h"
 
@@ -53,7 +55,6 @@
 #include "llcheckboxctrl.h"
 #include "llcombobox.h"
 #include "llfilepicker.h"
-#include "llfloaterdaycycle.h"
 #include "llfloatergodtools.h"	// for send_sim_wide_deletes()
 #include "llfloatertopobjects.h" // added to fix SL-32336
 #include "llfloatergroups.h"
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index a3b91223b78bed0785923fcaf73af96104e99f8b..42ed5b6f424ae5f80ca9f9aef7279c9588ad04a5 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -35,9 +35,12 @@
 #define LL_LLFLOATERREGIONINFO_H
 
 #include <vector>
+#include "llassettype.h"
 #include "llfloater.h"
+#include "llhost.h"
 #include "llpanel.h"
 
+class LLDispatcher;
 class LLLineEditor;
 class LLMessageSystem;
 class LLPanelRegionInfo;
@@ -51,6 +54,7 @@ class LLNameListCtrl;
 class LLSliderCtrl;
 class LLSpinCtrl;
 class LLTextBox;
+class LLVFS;
 
 class LLPanelRegionGeneralInfo;
 class LLPanelRegionDebugInfo;
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 1f3bd50d5b6ed04bd651f881980dccbf2ca312eb..d9fcf6f7b7cf32f015ccc9990dbe581ae3e8c4fe 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -40,12 +40,15 @@
 // linden library includes
 #include "llassetstorage.h"
 #include "llfontgl.h"
-#include "llgl.h"			// for renderer
+#include "llimagej2c.h"
 #include "llinventory.h"
 #include "llnotificationsutil.h"
 #include "llstring.h"
 #include "llsys.h"
 #include "llversionviewer.h"
+#include "llvfile.h"
+#include "llvfs.h"
+#include "mean_collision_data.h"
 #include "message.h"
 #include "v3math.h"
 
diff --git a/indra/newview/llfloaterurldisplay.cpp b/indra/newview/llfloaterurldisplay.cpp
index 3b9321a87697a72307b0fa200fc7dc3e6cf61e33..4b67cbb30872a2c0946abe2eb3d458c433f26d07 100644
--- a/indra/newview/llfloaterurldisplay.cpp
+++ b/indra/newview/llfloaterurldisplay.cpp
@@ -33,13 +33,14 @@
 
 #include "llviewerprecompiledheaders.h"
 
+#include "llregionhandle.h"
+#include "v3dmath.h"
+
 #include "llfloaterurldisplay.h"
 
 #include "llpanelplace.h"
 #include "lluictrlfactory.h"
 
-#include "v3dmath.h"
-
 ////////////////////////////////////////////////////////////////////////////
 // LLFloaterURLDisplay
 
diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp
index 5e769feea6158c776610ffa88d81970a0af1e434..91d0f0e370057086d8c9c350194be3a903b9f604 100644
--- a/indra/newview/llfloaterurlentry.cpp
+++ b/indra/newview/llfloaterurlentry.cpp
@@ -32,6 +32,8 @@
 
 #include "llviewerprecompiledheaders.h"
 
+#include "llhttpclient.h"
+
 #include "llfloaterurlentry.h"
 
 #include "llpanellandmedia.h"
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 7ca491a6987f02c5d28535d45f0c131940b9c42e..98f9171237a7c639150bc19262ee0559ebfc1c95 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -74,8 +74,8 @@
 #include "llmapimagetype.h"
 #include "llweb.h"
 #include "llslider.h"
+#include "message.h"
 
-#include "llglheaders.h"
 #include "llwindow.h"			// copyTextToClipboard()
 
 //---------------------------------------------------------------------------
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index fdb2b886a6a05032e7cdf80037b38a15a8a2d498..4c7e71f0405f2a645e3d4fedee748d8463e54cd3 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -35,6 +35,8 @@
 
 #include "llgroupactions.h"
 
+#include "message.h"
+
 #include "llagent.h"
 #include "llcommandhandler.h"
 #include "llfloaterreg.h"
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index f90bc35c3417c305bd02698f826ce7a73b0352e4..ab3e15c6b26dbd5a2950cc3ac1e4b2c89b8fce06 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -33,9 +33,10 @@
 #ifndef LL_IMFLOATER_H
 #define LL_IMFLOATER_H
 
-#include "lltransientdockablefloater.h"
+#include "llinstantmessage.h"
 #include "lllogchat.h"
 #include "lltooldraganddrop.h"
+#include "lltransientdockablefloater.h"
 
 class LLLineEditor;
 class LLPanelChatControlPanel;
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index 08d56f8b9f0b0e3b816749c494942e0074cabf93..f25d2ef5743fb8e05b2828318dbc1853ab7789af 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -38,6 +38,7 @@
 #include "llinventory.h"
 #include "lllandmark.h"
 #include "llparcel.h"
+#include "llregionhandle.h"
 
 #include "llnotificationsutil.h"
 
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index e65b7d8a0c61a2ee7742e75bd76ac6a69d27df65..45ae8bdbb1d3bee76d8da2bfe4706f529194861c 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -34,10 +34,12 @@
 
 #include "llnavigationbar.h"
 
-#include <llfloaterreg.h>
-#include <llfocusmgr.h>
-#include <lliconctrl.h>
-#include <llmenugl.h>
+#include "llregionhandle.h"
+
+#include "llfloaterreg.h"
+#include "llfocusmgr.h"
+#include "lliconctrl.h"
+#include "llmenugl.h"
 
 #include "llagent.h"
 #include "llviewerregion.h"
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index 8fb4ea42119eb226eb45eb6a4af62dafe0892dda..8dbaa5ac53a4d0e67e620c463b536fefeb629fd5 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -32,6 +32,8 @@
 
 #include "llviewerprecompiledheaders.h"
 
+#include "message.h"
+
 #include "llfloaterreg.h"
 #include "lltrans.h"
 
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 4ce6d14faae6bc30b0dc4d57909dbe31872c6bdd..4c99fca2dd676b44f500d65f18cef74a4f32aaad 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -37,6 +37,7 @@
 #include "llfloaterreg.h"
 #include "llsdutil.h"
 #include "llsdutil_math.h"
+#include "llregionhandle.h"
 
 #include "llaccordionctrl.h"
 #include "llaccordionctrltab.h"
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index cc6e88a9d2f99d73ec1364a32729da243ca1a464..1569c102be479f420191717c55fc5dacd13f103b 100644
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -37,6 +37,7 @@
 #include "llagent.h"
 #include "llagentpicksinfo.h"
 #include "llavatarconstants.h"
+#include "lldispatcher.h"
 #include "llflatlistview.h"
 #include "llfloaterreg.h"
 #include "llfloaterworldmap.h"
diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp
index 71d763b562062c6a9449738177ab5d8b2146fcc9..6985b73200bd57d18c342605b825aab70abf1b83 100644
--- a/indra/newview/llpanelplace.cpp
+++ b/indra/newview/llpanelplace.cpp
@@ -40,6 +40,7 @@
 #include "llsecondlifeurls.h"
 #include "llfloater.h"
 #include "llfloaterreg.h"
+#include "llregionhandle.h"
 
 #include "llagent.h"
 #include "llviewerwindow.h"
diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp
index 6ba3790fe226272b968670ad681ae8634dcba3c0..b845f38ace828cb7e33897a890475b8e198fb959 100644
--- a/indra/newview/llpanelplaceinfo.cpp
+++ b/indra/newview/llpanelplaceinfo.cpp
@@ -39,6 +39,8 @@
 #include "llsecondlifeurls.h"
 
 #include "llsdutil_math.h"
+#include "llregionhandle.h"
+#include "message.h"
 
 #include "lliconctrl.h"
 #include "lltextbox.h"
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index 0c7cc9af3857370f289fbae71f94280020b227d9..402d50ba9c30a5fe4ed19dd153e4d6798f2b18fb 100644
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -35,6 +35,7 @@
 #include "llpanelplaceprofile.h"
 
 #include "llparcel.h"
+#include "message.h"
 
 #include "lliconctrl.h"
 #include "lllineeditor.h"
diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h
index 9d2653945371063c2ff1ae22422fc8c36a8214c6..6241869e184efe9e7bf4c1a750c357f537809747 100644
--- a/indra/newview/llpreviewgesture.h
+++ b/indra/newview/llpreviewgesture.h
@@ -46,6 +46,7 @@ class LLScrollListItem;
 class LLButton;
 class LLGestureStep;
 class LLRadioGroup;
+class LLVFS;
 
 class LLPreviewGesture : public LLPreview
 {
diff --git a/indra/newview/llremoteparcelrequest.h b/indra/newview/llremoteparcelrequest.h
index 3a16e25ef619cc136c8579443698c1f6622056cb..c04f6b1858f8dd6b2ef05e91225461748daba0e8 100644
--- a/indra/newview/llremoteparcelrequest.h
+++ b/indra/newview/llremoteparcelrequest.h
@@ -38,6 +38,7 @@
 #include "llhttpclient.h"
 #include "llpanel.h"
 
+class LLMessageSystem;
 class LLRemoteParcelInfoObserver;
 
 class LLRemoteParcelRequestResponder : public LLHTTPClient::Responder
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index 8d3dcf8a9995e9fb1a5345402cb1d3264d6344a4..72ef383be93903091527c22b53552213b921ee66 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -31,8 +31,14 @@
  */
 
 #include "llviewerprecompiledheaders.h"
-#include "llagent.h"
+
 #include "lltexlayer.h"
+
+#include "llagent.h"
+#include "llimagej2c.h"
+#include "llimagetga.h"
+#include "llvfile.h"
+#include "llvfs.h"
 #include "llviewerstats.h"
 #include "llviewerregion.h"
 #include "llvoavatar.h"
diff --git a/indra/newview/lltexlayerparams.cpp b/indra/newview/lltexlayerparams.cpp
index 0c7e61d00e2e75ffe9aea9289d37d700cabf8c38..d55468841d84b15848464638caeb3459542e27d0 100644
--- a/indra/newview/lltexlayerparams.cpp
+++ b/indra/newview/lltexlayerparams.cpp
@@ -30,11 +30,14 @@
  */
 
 #include "llviewerprecompiledheaders.h"
+
+#include "lltexlayerparams.h"
+
 #include "llagent.h"
+#include "llimagetga.h"
 #include "lltexlayer.h"
 #include "llvoavatarself.h"
 #include "llwearable.h"
-#include "lltexlayerparams.h"
 #include "llui.h"
 
 //-----------------------------------------------------------------------------
diff --git a/indra/newview/lltexlayerparams.h b/indra/newview/lltexlayerparams.h
index 2b80dbdba4cf34833489f92347b57141af8321f9..93d01352d48d920882eaa0346d2bc29ba4d179ef 100644
--- a/indra/newview/lltexlayerparams.h
+++ b/indra/newview/lltexlayerparams.h
@@ -34,7 +34,11 @@
 
 #include "llviewervisualparam.h"
 
+class LLImageRaw;
+class LLImageTGA;
 class LLTexLayer;
+class LLTexLayerInterface;
+class LLViewerTexture;
 class LLVOAvatar;
 class LLWearable;
 
diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h
index bc9c988648baeca9bdfdabbf7bf2a86397f67b73..4203cbbc433c178bc58d3a8b7920ac803b19a7f4 100644
--- a/indra/newview/lltexturecache.h
+++ b/indra/newview/lltexturecache.h
@@ -40,6 +40,7 @@
 
 #include "llworkerthread.h"
 
+class LLImageFormatted;
 class LLTextureCacheWorker;
 
 class LLTextureCache : public LLWorkerThread
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 9bb2a4ad0a9c0d035e0936c1833f9d2b92b0b3a3..40ee042eb1d272769a8b1cbdd4e114f73db9af5a 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -43,8 +43,10 @@
 #include "llhttpclient.h"
 #include "llhttpstatuscodes.h"
 #include "llimage.h"
+#include "llimagej2c.h"
 #include "llimageworker.h"
 #include "llworkerthread.h"
+#include "message.h"
 
 #include "llagent.h"
 #include "lltexturecache.h"
diff --git a/indra/newview/lltexturestatsuploader.cpp b/indra/newview/lltexturestatsuploader.cpp
index e0358e1fcafbdff4d942df50d8534df18871f457..1df73db9b08df833d3f5a445bcafcc78b2fd5428 100644
--- a/indra/newview/lltexturestatsuploader.cpp
+++ b/indra/newview/lltexturestatsuploader.cpp
@@ -34,6 +34,8 @@
 
 #include "lltexturestatsuploader.h"
 
+#include "llhttpclient.h"
+
 LLTextureStatsUploader::LLTextureStatsUploader()
 {
 }
diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp
index f928b5f243b5dc840b1ad22b9824863234f5394f..ae1f87b6cfe33942eb36bbb16e7783c18ce010b2 100644
--- a/indra/newview/lltoastimpanel.cpp
+++ b/indra/newview/lltoastimpanel.cpp
@@ -34,6 +34,7 @@
 #include "lltoastimpanel.h"
 
 #include "llnotifications.h"
+#include "llinstantmessage.h"
 
 const S32 LLToastIMPanel::DEFAULT_MESSAGE_MAX_LINE_COUNT	= 6;
 
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 6b9bff7b9e57ecd993e698337c35344897db803b..766cf83a01218b76e9269dea3bc3565f9bc9197a 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -38,6 +38,7 @@
 #include "llviewercontrol.h"
 
 // library includes
+#include "lldbstrings.h"
 #include "llnotifications.h"
 #include "lluiconstants.h"
 #include "llrect.h"
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index 46618d40268966533287006d1ca198c41af047ec..164a45eed1f149884a1107f7b0fcdcf00c951f38 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -41,6 +41,7 @@
 #include "llfloaterurldisplay.h"
 #include "llfloaterworldmap.h"
 #include "llpanellogin.h"
+#include "llregionhandle.h"
 #include "llsidetray.h"
 #include "llslurl.h"
 #include "llstartup.h"			// gStartupState
diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp
index c32e67ef90f36465d7742f2e663484907d590dc5..440828da686ba4e1fe6ae2d3f8177a7c9ca59af0 100644
--- a/indra/newview/llviewerassetstorage.cpp
+++ b/indra/newview/llviewerassetstorage.cpp
@@ -32,13 +32,14 @@
 
 #include "llviewerprecompiledheaders.h"
 
-#include "linden_common.h"
-
-#include "llagent.h"
 #include "llviewerassetstorage.h"
-#include "llviewerbuild.h"
+
 #include "llvfile.h"
 #include "llvfs.h"
+#include "message.h"
+
+#include "llagent.h"
+#include "llviewerbuild.h"
 
 LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
 										   LLVFS *vfs, const LLHost &upstream_host)
diff --git a/indra/newview/llviewergenericmessage.h b/indra/newview/llviewergenericmessage.h
index 6e1f0945b8c2595ccb707c1bbbf75802d85bdae8..6b0a2e5d81bdba4b5f65e56f11127534085ba8c8 100644
--- a/indra/newview/llviewergenericmessage.h
+++ b/indra/newview/llviewergenericmessage.h
@@ -36,6 +36,7 @@
 
 class LLUUID;
 class LLDispatcher;
+class LLMessageSystem;
 
 
 void send_generic_message(const std::string& method,
diff --git a/indra/newview/llviewerjoint.h b/indra/newview/llviewerjoint.h
index 0e993a2ebe2dde54ade93156f3a1ae1a9a82162d..08c4ec36fdedd3a90e5b59b8e9df377dbd584096 100644
--- a/indra/newview/llviewerjoint.h
+++ b/indra/newview/llviewerjoint.h
@@ -37,7 +37,6 @@
 // Header Files
 //-----------------------------------------------------------------------------
 #include "lljoint.h"
-#include "llapr.h"
 
 class LLFace;
 class LLViewerJointMesh;
diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h
index 543679c44bd41a47f63584e1667c22cd76a0bb48..d62b0ada850874bc595ebd72111ee4908879959d 100644
--- a/indra/newview/llviewerjointmesh.h
+++ b/indra/newview/llviewerjointmesh.h
@@ -37,7 +37,6 @@
 #include "llviewertexture.h"
 #include "llpolymesh.h"
 #include "v4color.h"
-#include "llapr.h"
 
 class LLDrawable;
 class LLFace;
diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h
index 01a6b341707bb4f28a85a63924d0c2943d497f59..8266452d8583cc2714fa3d1732b003147398983a 100644
--- a/indra/newview/llviewermenu.h
+++ b/indra/newview/llviewermenu.h
@@ -36,6 +36,7 @@
 #include "llmenugl.h"
 #include "llsafehandle.h"
 
+class LLMessageSystem;
 class LLSD;
 class LLUICtrl;
 class LLView;
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 4b0dc8f668b4cbeeba39c186b10d444d562f11b7..576528d543303ba418715d581c1a2b37e9166121 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -40,6 +40,12 @@
 #include "llfloaterreg.h"
 #include "llfloaterbuycurrency.h"
 #include "llfloatersnapshot.h"
+#include "llimage.h"
+#include "llimagebmp.h"
+#include "llimagepng.h"
+#include "llimagej2c.h"
+#include "llimagejpeg.h"
+#include "llimagetga.h"
 #include "llinventorymodel.h"	// gInventory
 #include "llresourcedata.h"
 #include "llfloaterperms.h"
@@ -47,6 +53,8 @@
 #include "llviewercontrol.h"	// gSavedSettings
 #include "llviewertexturelist.h"
 #include "lluictrlfactory.h"
+#include "llvfile.h"
+#include "llvfs.h"
 #include "llviewerinventory.h"
 #include "llviewermenu.h"	// gMenuHolder
 #include "llviewerregion.h"
@@ -67,6 +75,7 @@
 #include "lltransactiontypes.h"
 #include "lluuid.h"
 #include "llvorbisencode.h"
+#include "message.h"
 
 // system libraries
 #include <boost/tokenizer.hpp>
diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h
index da78537a295c3993c0583460f5db5c059172fc8c..1e6d13f1c62cbffdeb2706b59fd79ea6c464afc8 100644
--- a/indra/newview/llviewermenufile.h
+++ b/indra/newview/llviewermenufile.h
@@ -34,6 +34,7 @@
 #define LLVIEWERMENUFILE_H
 
 #include "llfoldertype.h"
+#include "llassetstorage.h"
 #include "llinventorytype.h"
 
 class LLTransactionID;
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 23d02af73d2cd503c5c090b4f832413ff257b844..33361f72cd42095f76692a8453079f58ebc75e5f 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -59,6 +59,8 @@
 #include "llteleportflags.h"
 #include "lltracker.h"
 #include "lltransactionflags.h"
+#include "llvfile.h"
+#include "llvfs.h"
 #include "llxfermanager.h"
 #include "message.h"
 #include "sound_ids.h"
diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h
index 1a98828010f8e1ac2f0bb6e7b32589139cc29a0f..8404d6fde026b097b038ebcbd87077c76142e0a7 100644
--- a/indra/newview/llviewermessage.h
+++ b/indra/newview/llviewermessage.h
@@ -33,10 +33,12 @@
 #ifndef LL_LLVIEWERMESSAGE_H
 #define LL_LLVIEWERMESSAGE_H
 
+#include "llassettype.h"
 #include "llinstantmessage.h"
 #include "llpointer.h"
 #include "lltransactiontypes.h"
 #include "lluuid.h"
+#include "message.h"
 #include "stdenums.h"
 
 //
@@ -47,6 +49,7 @@ class LLInventoryObject;
 class LLInventoryItem;
 class LLMeanCollisionData;
 class LLMessageSystem;
+class LLVFS;
 class LLViewerObject;
 class LLViewerRegion;
 
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index 801c46035a20e2c438d23c9b8c70ba2edb67cd54..d7b55d7e978ef571c951f87edd9374ee3d761dec 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -34,8 +34,11 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llviewernetwork.h"
-#include "llviewercontrol.h"
+
 #include "llevents.h"
+#include "net.h"
+
+#include "llviewercontrol.h"
 #include "lllogin.h"
 
 struct LLGridData
diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h
index 86f59b6e2f8cffc7099747d14516e337a82525ff..93a980d9e823251492e50e300e66ad2fafe113b5 100644
--- a/indra/newview/llviewerprecompiledheaders.h
+++ b/indra/newview/llviewerprecompiledheaders.h
@@ -41,17 +41,6 @@
 
 #include "linden_common.h"
 
-// We may want to take the windows.h include out, but it used to be in 
-// linden_common.h, and hence in all the libraries.  This is better. JC
-#if LL_WINDOWS
-	// Limit Windows API to small and manageable set.
-	// If you get undefined symbols, find the appropriate
-	// Windows header file and include that in your .cpp file.
-	#define WIN32_LEAN_AND_MEAN
-	#include <winsock2.h>
-	#include <windows.h>
-#endif
-
 // Work around stupid Microsoft STL warning
 #ifdef LL_WINDOWS
 #pragma warning (disable : 4702) // warning C4702: unreachable code
@@ -76,21 +65,14 @@
 //#include "llpreprocessor.h"
 #include "llallocator.h"
 #include "llapp.h"
-#include "llapr.h"
 #include "llcriticaldamp.h"
-//#include "lldarray.h"
-//#include "lldarrayptr.h"
 #include "lldefs.h"
 #include "lldepthstack.h"
-//#include "lldqueueptr.h"
-#include "llendianswizzle.h"
 #include "llerror.h"
 #include "llfasttimer.h"
 #include "llframetimer.h"
 #include "llhash.h"
 #include "lllocalidhashmap.h"
-#include "llmap.h"
-//#include "llmemory.h"
 #include "llnametable.h"
 #include "llpointer.h"
 #include "llpriqueuemap.h"
@@ -100,7 +82,6 @@
 //#include "llsecondlifeurls.h"
 #include "llsd.h"
 #include "llsingleton.h"
-#include "llstack.h"
 #include "llstat.h"
 #include "llstl.h"
 #include "llstrider.h"
@@ -118,19 +99,7 @@
 #include "timing.h"
 #include "u64.h"
 
-// Library includes from llimage
-//#include "llblockdata.h"
-#include "llimage.h"
-#include "llimagebmp.h"
-#include "llimagepng.h"
-#include "llimagej2c.h"
-#include "llimagejpeg.h"
-#include "llimagetga.h"
-#include "llmapimagetype.h"
-
 // Library includes from llmath project
-//#include "camera.h"
-//#include "coordframe.h"
 #include "llmath.h"
 #include "llbboxlocal.h"
 #include "llcamera.h"
@@ -158,80 +127,11 @@
 ////#include "vmath.h"
 #include "xform.h"
 
-// Library includes from llmessage project
-//#include "llassetstorage.h"
-#include "llcachename.h"
-#include "llcircuit.h"
-#include "lldatapacker.h"
-#include "lldbstrings.h"
-#include "lldispatcher.h"
-#include "lleventflags.h"
-#include "llhost.h"
-#include "llinstantmessage.h"
-#include "llinvite.h"
-//#include "llloginflags.h"
-#include "llmail.h"
-#include "llmessagethrottle.h"
-#include "llnamevalue.h"
-#include "llpacketack.h"
-#include "llpacketbuffer.h"
-#include "llpacketring.h"
-#include "llpartdata.h"
-//#include "llqueryflags.h"
-//#include "llregionflags.h"
-#include "llregionhandle.h"
-#include "lltaskname.h"
-#include "llteleportflags.h"
-#include "llthrottle.h"
-#include "lltransfermanager.h"
-#include "lltransfersourceasset.h"
-#include "lltransfersourcefile.h"
-#include "lltransfertargetfile.h"
-#include "lltransfertargetvfile.h"
-#include "lluseroperation.h"
-#include "llvehicleparams.h"
-#include "llxfer.h"
-#include "llxfer_file.h"
-#include "llxfer_mem.h"
-#include "llxfer_vfile.h"
-#include "llxfermanager.h"
-#include "machine.h"
-#include "mean_collision_data.h"
-#include "message.h"
-#include "message_prehash.h"
-#include "net.h"
-//#include "network.h"
-#include "partsyspacket.h"
-#include "patch_code.h"
-#include "patch_dct.h"
-#include "sound_ids.h"
-
-// Builds work with all headers below commented out as of 2009-09-10 JC
-
-// Library includes from llprimitive
-#include "imageids.h"
-#include "legacy_object_types.h"
-#include "llmaterialtable.h"
-//#include "llprimitive.h"
-#include "lltextureanim.h"
-//#include "lltextureentry.h"
-#include "lltreeparams.h"
-//#include "llvolume.h"
-#include "llvolumemgr.h"
-#include "material_codes.h"
-
 // Library includes from llvfs
-#include "llassettype.h"
 #include "lldir.h"
-//#include "lldir_linux.h"
-//#include "lldir_mac.h"
-//#include "lldir_win32.h"
-#include "llvfile.h"
-#include "llvfs.h"
 
-// Library includes from llui
-// In skinning-7, llui.h dependencies are changing too often.
-//#include "llui.h"
+// Library includes from llmessage project
+#include "llcachename.h"
 
 // llxuixml
 #include "llinitparam.h"
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 939d5e3970dff8b12f36ae38f81b68ead2bde7e1..a1a3bc6d6a05299a5ea334b19c48ef32868a2e68 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -39,6 +39,7 @@
 #include "llfloaterreg.h"
 #include "llmemory.h"
 #include "lltimer.h"
+#include "llvfile.h"
 
 #include "llappviewer.h"
 
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 0d29efaedf5acd27bacb941c43b26723380f3d43..304b045423fa1f1bd2215bb4ba8eee6b1f25b243 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -108,6 +108,19 @@ const F64 log_2 = log(2.0);
 //----------------------------------------------------------------------------------------------
 //namespace: LLViewerTextureAccess
 //----------------------------------------------------------------------------------------------
+
+LLLoadedCallbackEntry::LLLoadedCallbackEntry(loaded_callback_func cb,
+					  S32 discard_level,
+					  BOOL need_imageraw, // Needs image raw for the callback
+					  void* userdata ) 
+	: mCallback(cb),
+	  mLastUsedDiscard(MAX_DISCARD_LEVEL+1),
+	  mDesiredDiscard(discard_level),
+	  mNeedsImageRaw(need_imageraw),
+	  mUserData(userdata)
+{
+}
+
 LLViewerMediaTexture* LLViewerTextureManager::createMediaTexture(const LLUUID &media_id, BOOL usemipmaps, LLImageGL* gl_image)
 {
 	return new LLViewerMediaTexture(media_id, usemipmaps, gl_image) ;		
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 141979052d7636ca1d48cb28f0a0df3fbb8f65b4..d6fbd5d5709994c104468f553b9af2776924299a 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -49,12 +49,14 @@
 
 class LLFace;
 class LLImageGL ;
+class LLImageRaw;
 class LLViewerObject;
 class LLViewerTexture;
 class LLViewerFetchedTexture ;
 class LLViewerMediaTexture ;
 class LLTexturePipelineTester ;
 
+
 typedef	void	(*loaded_callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata );
 
 class LLVFile;
@@ -68,14 +70,7 @@ public:
 	LLLoadedCallbackEntry(loaded_callback_func cb,
 						  S32 discard_level,
 						  BOOL need_imageraw, // Needs image raw for the callback
-						  void* userdata ) 
-		: mCallback(cb),
-		  mLastUsedDiscard(MAX_DISCARD_LEVEL+1),
-		  mDesiredDiscard(discard_level),
-		  mNeedsImageRaw(need_imageraw),
-		  mUserData(userdata)
-	{
-	}
+						  void* userdata );
 
 	loaded_callback_func	mCallback;
 	S32						mLastUsedDiscard;
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index 028f8441ab0a44f48dadbe2dd38f580ca8ad5018..ab55bfd04d99093a54b7d1aa97149fa49f197410 100644
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -53,6 +53,7 @@ const BOOL GL_TEXTURE_NO = FALSE;
 const BOOL IMMEDIATE_YES = TRUE;
 const BOOL IMMEDIATE_NO = FALSE;
 
+class LLImageJ2C;
 class LLMessageSystem;
 class LLTextureView;
 
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 9ba056a17c0e60db1968e84ba42e276e8e900c93..e9f369ab1d702b56c720564eb6d15e7d9d27fa62 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -32,6 +32,8 @@
 
 #include "llviewerprecompiledheaders.h"
 
+#include "llviewerwindow.h"
+
 #if LL_WINDOWS
 #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
 #endif
@@ -46,7 +48,6 @@
 #include "llpanellogin.h"
 #include "llviewerkeyboard.h"
 #include "llviewermenu.h"
-#include "llviewerwindow.h"
 
 #include "llviewquery.h"
 #include "llxmltree.h"
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index 1d564a133835c2e867cefbb320bb8f69ffde31e5..2b87fabb4fd0b2b019742f68df8d702bbedc24af 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -50,6 +50,7 @@
 #include "llmousehandler.h"
 #include "llcursortypes.h"
 #include "llhandle.h"
+#include "llimage.h"
 
 #include <boost/function.hpp>
 #include <boost/signals2.hpp>
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index a9194c0c3b4555d084cddbe9472d66e51813f968..9ff5769a3ecc3c23e26939d5681ed5abe8dc776c 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -45,6 +45,7 @@
 
 #include "llaudioengine.h"
 #include "noise.h"
+#include "sound_ids.h"
 
 #include "llagent.h" //  Get state values from here
 #include "llagentwearables.h"
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 06e214b41e307cb9747bfaa55c0603b77cbdd6a5..5e42b9fad41d3eadc80d0cae2899185c14447211 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -37,7 +37,6 @@
 #include "llviewertexture.h"
 #include "llviewermedia.h"
 #include "llframetimer.h"
-#include "llapr.h"
 #include "m3math.h"		// LLMatrix3
 #include "m4math.h"		// LLMatrix4
 #include <map>
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index c8cc6a3d8ebe69540af02bf3bdcc929b7e614dad..839fc3068870052333c723b96cbf20c68f469452 100644
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -51,16 +51,13 @@
 #include "llsdserialize.h"
 
 #include "v4math.h"
-#include "llviewerdisplay.h"
 #include "llviewercontrol.h"
-#include "llviewerwindow.h"
 #include "lldrawpoolwater.h"
 #include "llagent.h"
 #include "llviewerregion.h"
 
 #include "llwlparammanager.h"
 #include "llwaterparamset.h"
-#include "llpostprocess.h"
 #include "llfloaterwater.h"
 
 #include "curl/curl.h"
diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp
index fcc43c2b1f7b8cc1d390ad63f48c1abb2f84602e..000d50795fef590a7b86fab373cee4216cf05e4c 100644
--- a/indra/newview/llwldaycycle.cpp
+++ b/indra/newview/llwldaycycle.cpp
@@ -33,11 +33,13 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llwldaycycle.h"
-#include "llsdserialize.h"
-#include "llwlparammanager.h"
+
 #include "llnotificationsutil.h"
+#include "llsdserialize.h"
 #include "llxmlnode.h"
 
+#include "llwlparammanager.h"
+
 #include <map>
 
 LLWLDayCycle::LLWLDayCycle() : mDayRate(120)
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index c6fd35c1422522bec6160efcd86c63fbea01b1c3..d11a84054532ddf244678864ec00c18c6f013ea5 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -42,17 +42,12 @@
 #include "llspinctrl.h"
 #include "llcheckboxctrl.h"
 #include "lluictrlfactory.h"
-#include "llviewercamera.h"
 #include "llcombobox.h"
 #include "lllineeditor.h"
 #include "llsdserialize.h"
 
 #include "v4math.h"
-#include "llviewerdisplay.h"
 #include "llviewercontrol.h"
-#include "llviewerwindow.h"
-#include "lldrawpoolwater.h"
-#include "llviewerregion.h"
 
 #include "llwlparamset.h"
 #include "llpostprocess.h"
diff --git a/indra/newview/llworldmapmessage.cpp b/indra/newview/llworldmapmessage.cpp
index 6a074d9697fc70402087c999fca59cfae8b12864..06040a574c579a6387023c72d111cde6fbba9eed 100644
--- a/indra/newview/llworldmapmessage.cpp
+++ b/indra/newview/llworldmapmessage.cpp
@@ -33,6 +33,7 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llworldmapmessage.h"
+#include "message.h"
 
 #include "llworldmap.h"
 #include "llagent.h"
diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp
index af8cb6b9fb87868e5801d38daff5376bb520e725..15417614af905117eb42c2ab66d9d837ccb1ef38 100644
--- a/indra/newview/llxmlrpclistener.cpp
+++ b/indra/newview/llxmlrpclistener.cpp
@@ -21,13 +21,14 @@
 // external library headers
 #include <boost/scoped_ptr.hpp>
 #include <boost/range.hpp>          // boost::begin(), boost::end()
+#include <xmlrpc-epi/xmlrpc.h>
+#include "curl/curl.h"
+
 // other Linden headers
 #include "llerror.h"
 #include "stringize.h"
 #include "llxmlrpctransaction.h"
 
-#include <xmlrpc-epi/xmlrpc.h>
-
 #if LL_WINDOWS
 #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
 #endif