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.)
- minus to exclude words, example: I want to find a song named
get lucky
, I don’t remember the artist but I know it’s not the Daft Punk one. I can typeget lucky song -daft
and immediately get what I need. Sometimes I’ll go through a few iterations of excluding words site:
include only specific domain in results, for examplescanform site:qed.ai
When searching, especially for things like compile/runtime errors:
- first adjust your query using the operators so that it seems like (from titles and text previews) that results mostly make sense
- scroll down through results and click on anything that looks semi-promising while holding ctrl, this will open each result in a new tab while you stay at the results tab. Possibly go over multiple result pages. Adjust how many results you open depending on how promising they look
- Switch to the tab with the first result (to not lose the query tab yet)
- Glance over the question to see if is related and how much, but not too long
- Jump to the few top answers and inspect them, also watch out for highly upvoted comments
- If the current page is not helpful close it with
ctrl + w
, this will close the current tab and show the tab with the 2nd result. Repeat until you find something helpful
With time you’ll be able to discern which results are applicable quicker and quicker, and this way of navigating is a lot faster than opening a result, going back, opening second result and so on
Sign up for new github code search preview at cs.github.com
It’s infinitely better than the current search bar. It can be immensely helpful to find existing usages of some library functions you want to use etc.
If you want to inspect (part of) github repo in more detail, as in more than just one file, open that repository in github and hit .
(dot). This will open the repository in an online version of vs code, you’ll be able to jump to function definition/usage (regular github browser also has jump to definition btw.), use vs code search etc.