Including "StaticMesh.h" breaks my code

HI guys,

I’m trying to use a staticmesh in my component class. The issue is that its undefined unless I include the header(duh). But when I include the header it throws an error in an unrelated file.

D:\Unreal Engine\UnrealEngine\Engine\Source\Runtime\CoreUObject\Public\UObject/UObjectIterator.h(37): error C2660: ‘GetObjectW’: function does not take 0 arguments

I’ve not touched that file in any way. So how do I properly include StaticMesh.h?

My cpp file is in “Engine/source/Runtime/Engine/Classes/Components”

Alright, I figured it out. The order you put the includes matter. I had my include closer to the bottom of my include list. When I moved it to the top I can build without errors now.

If anyone could elaborate on why that solved this problem that would be great though.