First, isolate the actual error message. Sometimes it can be buried in hundreds of lines of warnings and unrelated output (c++ templates are notorious for that, things are getting better with colored higlighted output tho, clang usually gives better output than gcc).
Sometimes the best way is to literally search for the word “error” in the output/terminal.
If you don’t (almost) almost immediately know what’s wrong it almost always make sense to copy the error into Google. After copying try to figure out which parts are specific to your code (like function/variable names, specific memory addresses etc.) and remove them before hitting search. This will make results more focused as Google will not try and include your specifics.
Learn google search operators if you don’t know them. Most useful ones are:
- quotes to search for exact phrases (normally google includes synonyms, different word order, disjoin words etc.)