Flies are attracted to dead bodies, piles of food (including unpicked crops on the farm) and pools of water.
Reasons you don't want them:
- They may cause food to rot (I've seen it mentioned in a few places but haven't been able to verify for certain)
- They cause negative thoughts "annoyed by flies" (this thought can apply to all dwarves)
- They cause further negative thoughts in dwarves that particularly hate flies: "Accosted by terrible vermin".
Note that they don't have the
[VERMIN_EATER] tag, so they won't actually eat your food, just buzz around it, annoy dwarves, and possibly speed up rotting.
Here is some advice on protecting against flies:
Flies are a type of above ground vermin. They are found in swarms near pools, farms with unpicked food and food stockpiles, and may cause food to rot. Since cats cannot kill flies, the best way to protect against them is to make sure food is not left outside of a container too long. Make sure you have enough barrels and bags to store your food and someone ready to pick food from farms once ready. If there's no food around outside of a container, flies will go away.
I would further suggest that you keep your food stockpile, your farms and your butcher's workshop in secluded areas. This means that if you do get flies, your dwarves are less likely to be bothered by them. Keeping the butcher's workshop in a secluded area (with a door) is a good idea anyway as butchers' workshops tend to generate miasma, which you also want to keep away from your dwarves.
They also tend to flicker in and out of visibility on the map, so if you're looking around the map whilst paused you might not see them. Narrow it down to a few places they might be, then watch those places and see if they pop up.
Can cats kill flies?
There seems to be some argument about this. As quoted above, the wiki page on flies says that cats cannot kill flies but doesn't seem to offer much explanation. However, I've not been able to find it explicitly contradicted either.
I've done some digging around and found that the
[HUNTS_VERMIN] tag (that cats have) is a bit confusing, mainly because there is no single
[VERMIN] tag that determines whether or not a creature is vermin. Instead there are lots of tags like
[VERMIN_MICRO], etc., which are overlapping and not mutually exclusive. So it probably depends on the exact implementation of that
[HUNTS_VERMIN] tag - there might be a list of all the vermin tags somewhere which it uses, or it might exclude some of them (like
[VERMIN_MICRO]) or only include some of them... hard to know.