Question about VC++ 2010 runtimes

I was looking here https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/abx4dbyh%28v%3dvs.100%29

And there appear to be two separate sets of runtimes libraries. They are called "C Run-Time Libraries (CRT)" and "Standard C++ Library" on that Microsoft webpage. What is the difference exactly between these 2 sets of runtimes?
It's pretty self-explanatory. The CRT contains implementations for C functions, such as printf(). The standard C++ library contains implementations for standard C++ classes, such as std::thread.
In that case, I assume the C++ library also has the basic C functions, it's just that if you are writing a C program (not a C++ program) you don't need the extra C++ functions, so you can link the C library without the extra C++ functionality (such as classes and operator overrides).
Actually c itself doesn't know anything about c++ hence a c compiler cannot link any c++ libraries.
Yes, linking happens in the linker, not the compiler. I meant, that if you write a c program (source code file ending with .c) after compiling, it can be linked with either C or C++ library. However, if you write a C++ program (source code file ending with .cpp) then it MUST be linked with the C++ library. Am I correct about that?
I meant, that if you write a c program (source code file ending with .c) after compiling, it can be linked with either C or C++ library.
No. If you write a pure C program you would not be able to use any C++ headers (since the compiler wouldn't even be able to parse them), and since the C++ standard library doesn't include any C function definitions, there would be no reason to link to it.

However, if you write a C++ program (source code file ending with .cpp) then it MUST be linked with the C++ library.
No, that's not entirely correct, either. You can write a C++ program that doesn't reference any part of the C++ standard library. Such a program would not need to link to any libraries.
For example, the minimal C++ program: int main(){}
Topic archived. No new replies allowed.