Question: I know that for running c++ on Windows you need to compile specifically for Windows and the same goes for linux and on...

But for example, if I'm compiling program for Windows written in native c++ I can run it on a freshly installed windows pc? I mean, without downloading visual c++ runtime libraries, etc, I can just compile it, let's say, reinstall windows on my computer, and run it without installing anything else?

(The question above using Windows as an example but the same thing can be done on freshly installed linux distro? e.g Ubuntu)
Thanks in advance.

Answer: 
The only answer is "it depends".

There are many ways that an OS can "run" a program, many ways a program can be build, and many way code can be assembled.

A program that uses only "standard libraries" and that **links all libraries statically**, does not need any other dependency (in the sense that all the code it need is in the binary itself or into OS libraries that -being part of the system itself- are already on the system).

But:

* statically link the standard libraries (which are most likely present in all programs) will bloat the memory usage of many copy of the same code. That's the reason library are often linked dynamically, but this requires "installation" of those libraries as well
* Programs that use only standard libraries can do only the things that are somehow "common" (or can be commonly represented) into all systems, thus loosing all the peculiarity that makes an OS different from another.
* There are "platforms" that - by the nature of their peripherals - are not represented one into the other: a coffee machine has 12 keys and a textual 2 row x 20 col display. A PC has a mouse, a keyboard, and a display that can reach even 10'000 pixel of width, of millions of color each. A tablet has a touch surface that can seize multiple points at the same time.
Can you imagine a program running the same on all those three platform?
Yes, the standard libraries are everywhere. Just think about it, most of your programs that you get are writen in C/C++. Only dependencies come when you use some specified libraries like winsock etc, therefore some windows applications are unlikely to work on linux and vice versa.