通过命令行编译:
For Linux the correct command is:
gcc -pthread -o term term.c
In general, libraries should follow sources and objects on command line, and -lpthread is not an "option", it's a library specification. On a system with only libpthread.a installed,
gcc -lpthread ...
will fail to link.
通过codeblocks编译:
settings->compiler->linker settings->other link options 写 -pthread