diff --git a/include/gen/FixLink.h b/include/gen/FixLink.h
new file mode 100644
index 0000000000000000000000000000000000000000..93cb5c66a18089104f390cc354b5b451c6bc6043
--- /dev/null
+++ b/include/gen/FixLink.h
@@ -0,0 +1,58 @@
+/* Copyright (c) 2006, NIF File Format Library and Tools
+All rights reserved.  Please see niflib.h for license. */
+
+//---THIS FILE WAS AUTOMATICALLY GENERATED.  DO NOT EDIT---//
+
+//To change this file, alter the niftools/docsys/nifxml_niflib.py Python script.
+
+#include "../../include/obj/NiObject.h"
+namespace Niflib {
+
+using namespace std;
+
+const char FIX_LINK_POP_ERROR[] = "Trying to pop a link from empty stack. This is probably a bug.";
+const char FIX_LINK_INDEX_ERROR[] = "Object index was not found in object map.  This NIF file may be invalid or imporperly supported.";
+const char FIX_LINK_CAST_ERROR[] = "Link could not be cast to required type during file read. This NIF file may be invalid or improperly supported.";
+
+template <class T>
+Ref<T> FixLink( const map<unsigned,NiObjectRef> & objects, list<unsigned int> & link_stack, const NifInfo & info ) {
+	if (link_stack.empty()) {
+		throw runtime_error(FIX_LINK_POP_ERROR);
+	}
+	unsigned int index = link_stack.front();
+	link_stack.pop_front();
+
+	//Check if link is NULL
+	if ( info.version > VER_3_3_0_13) {
+	    if ( index == 0xFFFFFFFF) {
+		    return NULL;
+	    }
+	} else {
+	    if ( index == 0 ) {
+		return NULL;
+	    }
+	}
+
+	map<unsigned int,NiObjectRef>::const_iterator it = objects.find(index);
+	if ( it == objects.end() ) {
+		if ( info.version > VER_3_3_0_13 ) {
+			throw runtime_error(FIX_LINK_INDEX_ERROR);
+		} else {
+			return NULL;
+		}
+	}
+		
+	Ref<T> object = DynamicCast<T>(it->second);
+	if ( object == NULL ) {
+		stringstream ss;
+		ss << FIX_LINK_CAST_ERROR << endl;
+		ss << "Type of object with index " << index << " was:  " << it->second->GetType().GetTypeName() << endl;
+		ss << "Required type was:  " << T::TYPE.GetTypeName() << endl;
+		throw runtime_error( ss.str().c_str() );
+	}
+
+	return object;
+}
+
+} //End namespace Niflib
+