g++ why don't you have to link iostream binaries but for pthread you do?
问题 If you have a very basic C++ program that only uses the 'cout' object, you can include iostream in the source file and then when you compile it you don't have to link any external libraries. In other words, you can simply run g++ main.cpp -c g++ main.o -o program ./program When you want to use more complicated objects such as threads, not only do you include pthread, but when you link the program you have to link to a library. g++ main.cpp -c g++ main.o -lpthread -o program ./program So my