Which way would be better to add an error massage to the required empty field or it could be just highlighted?
Highlightening it while giving a proper error message like "This field cannot be empty".
But first, you should ask yourself WHY your users left it blank in the first way. Does the fact that the mandatory field is not clear enough for your user? Is it because you ask a question that people don't want to answer?
I would say to think about it first and then think about your question again. My answer doesn't work if your users don't want to answer the question out of principle.
Simply highlighting a field makes it easily noticeable when the user needs to correct it but gives the user no context as to why it is highlighted, for example if a password field is just highlighted this could be any number of issues as to why is been highlighted. This can also cause accessibility issues, especially if you're relying on colour alone as the highlight. Just highlighting with no textual context will only cause confusion and could cause users to drop off.
Simply adding inline form validation is great for context as to what the error is but while nestled among other fields and field headers maybe less easier to spot.
I would recommend both for efficiency for the user to complete it quicker.
For more info read this.