参考链接: https://stackoverflow.com/questions/58848694/gcc-whole-archive-recipe-for-static-linking-to-pthread-stopped-working-in-rec
vscode task.json 设置:
"args": [
"-g",
"${file}",
"-std=c++17",
"-Wall",
"-static",
"-Wl,--whole-archive",
"-lrt",
"-lpthread",
"-Wl,--no-whole-archive",
"-o",
"${fileDirname}/a.out"
],
注意-Wl后边逗号前后没有空格。
转载请注明原文地址:https://blackberry.8miu.com/read-35033.html