Dear Wot I identify with the problem you seem to have and I do sympathise!
I was raised with four older brothers and went to an all girl's grammar school so as I grew up my experience of the other sex was very limited and I would say I was openly friendly towards all men, but that is all - just conversationally friendly!!! I would never describe myself as 'sexy' even in my hayday (!) and I didn't wear makeup. But on a few occasions I have had men begin to flirt and/or be suggestive. As soon as I have realised I have drawn back and been careful, but none of the attention has ever ben invited by me. I honestly think some men have very big egos and it is evident that some also have some very negative attitudes towards women.
I said I have learned to be careful, but it is frustrating when you are just being nice and someone misinterprets it - wilfully I would say. Even down to offering a a tradesman a cup of tea ...
I also noticed a distinct shift (for the worst) when I became a divorcee - it does seem that if some men know you are single (and some of them still married) you become fair game for lewd advances!!!
I'm sorry you have had to put up with unwanted attention. Yes, we do have to think what can we do to try to ensure it doesn't happen, but actually men should behave better and have more sense!