"for" is, among other usages, a preposition of time, expressing duration or a length of time.
In English, this "for" can be omitted from the time phrase (e.g. for 45 minutes) in some cases and the remaining noun phrase (e.g. 45 minutes) can still be understood as the adverbial for expressing time duration.
The omission happens after some "special" verbs such as "be", "live", "wait", "work", "last", "stay" and etc.
These verbs have something in common:
1. stative meaning, and
2. with continuity
The verb "whistle" is a dynamic verb without any stative meaning, so "for" can't be omitted.
The verb "wait", when used to express duration, has stative meaning with continuity capability, so "for" can be omitted.
I hope you understand!