"args": [
"-g",
"${file}",
"-std=c++17",
"-Wall",
"-static",
"-Wl,--whole-archive",
"-lrt",
"-lpthread",
"-Wl,--no-whole-archive",
"-o",
"${fileDirname}/a.out"
],
网上搜了很久没找到正确了,隔了几天自己试成功了,给大家参考。
本文分享了一位开发者在配置C++编译选项时的经验,包括-g用于调试,-std=c++17指定C++标准,-Wall显示所有警告,-static使链接静态库,-lrt和-lpthread链接实时运行库和线程库,-Wl,--whole-archive与-Wl,--no-whole-archive用于全链接特定库,-o指定输出文件。这些技巧对于C++项目构建和优化至关重要。
"args": [
"-g",
"${file}",
"-std=c++17",
"-Wall",
"-static",
"-Wl,--whole-archive",
"-lrt",
"-lpthread",
"-Wl,--no-whole-archive",
"-o",
"${fileDirname}/a.out"
],
网上搜了很久没找到正确了,隔了几天自己试成功了,给大家参考。
9976

被折叠的 条评论
为什么被折叠?