{"id":115173,"date":"2026-10-11T12:08:59","date_gmt":"2026-10-11T04:08:59","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/115173.html"},"modified":"2026-10-11T12:08:59","modified_gmt":"2026-10-11T04:08:59","slug":"30%e5%a4%a9%e8%87%aa%e5%88%b6c%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%88day13%ef%bc%89%ef%bc%9a%e7%94%a8cmake%e3%80%81clang-format%e3%80%81cpplint%e4%b8%8eclang-tidy%e5%ae%8c%e6%88%90%e9%a1%b9%e7%9b%ae","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/115173.html","title":{"rendered":"30\u5929\u81ea\u5236C++\u670d\u52a1\u5668\uff08day13\uff09\uff1a\u7528CMake\u3001clang-format\u3001cpplint\u4e0eclang-tidy\u5b8c\u6210\u9879\u76ee\u5de5\u7a0b\u5316\u4e0e\u4ee3\u7801\u8d28\u91cf\u7ba1\u63a7"},"content":{"rendered":"<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u793a\u4f8b\u5de5\u7a0b<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u301130dayMakeCppServer<\/h3>\n<p class=\"gcb-project-desc\">30\u5929\u81ea\u5236C&#043;&#043;\u670d\u52a1\u5668&#xff0c;\u5305\u542b\u6559\u7a0b\u548c\u6e90\u4ee3\u7801<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/GitHub_Trending\/30\/30dayMakeCppServer<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<p>\u5728\u524d\u9762\u7684\u6559\u7a0b\u4e2d&#xff0c;\u6211\u4eec\u5df2\u7ecf\u5b8c\u6210\u4e86\u4e3b\u4ece Reactor \u591a\u7ebf\u7a0b\u670d\u52a1\u5668\u6838\u5fc3\u67b6\u6784\u7684\u5f00\u53d1\u3002\u4ece\u8fd9\u4e00\u5929\u5f00\u59cb&#xff0c;\u5f00\u53d1\u91cd\u5fc3\u4ece&#034;\u642d\u5efa\u67b6\u6784&#034;\u8f6c\u5411&#034;\u6253\u78e8\u7ec6\u8282&#034;&#xff1a;\u7528 CMake \u53d6\u4ee3\u624b\u5199 Makefile \u7ba1\u7406\u7f16\u8bd1\u94fe\u63a5&#xff0c;\u5207\u6362\u81f3 clang \u7f16\u8bd1\u5668&#xff0c;\u5e76\u5f15\u5165 clang-format\u3001cpplint\u3001clang-tidy \u4e09\u4ef6\u5957\u7edf\u4e00\u4ee3\u7801\u98ce\u683c\u3001\u9759\u6001\u67e5\u9519\u4e0e\u6027\u80fd\u5efa\u8bae\u3002\u8bfb\u5b8c\u672c\u6587&#xff0c;\u4f60\u5c06\u638c\u63e1\u4e00\u4e2a\u73b0\u4ee3 C&#043;&#043; \u7f51\u7edc\u5e93\u4ece\u6e90\u7801\u7ec4\u7ec7\u3001\u6784\u5efa\u914d\u7f6e\u5230\u81ea\u52a8\u4ee3\u7801\u5ba1\u67e5\u7684\u5b8c\u6574\u5de5\u7a0b\u5316\u6d41\u7a0b&#xff0c;\u5e76\u80fd\u76f4\u63a5\u5728\u5f53\u524d\u4ed3\u5e93 code\/day13 \u4e2d\u590d\u73b0\u8fd9\u5957\u6d41\u7a0b\u3002<\/p>\n<h3>\u4e3a\u4ec0\u4e48 C&#043;&#043; \u9879\u76ee\u4e00\u5b9a\u8981\u5de5\u7a0b\u5316<\/h3>\n<p>\u5728 day12 \u4e4b\u524d&#xff0c;\u6240\u6709\u6e90\u6587\u4ef6\u90fd\u5806\u5728\u540c\u4e00\u4e2a\u6587\u4ef6\u5939\u91cc\u3001\u9760\u624b\u5199\u7684 Makefile \u9010\u4e2a\u7f16\u8bd1\u94fe\u63a5\u3002\u968f\u7740\u6a21\u5757\u8d8a\u6765\u8d8a\u591a&#xff0c;\u8fd9\u5ea7&#034;\u4ee3\u7801\u5c4e\u5c71&#034;\u7684\u53ef\u8bfb\u6027\u3001\u53ef\u7ef4\u62a4\u6027\u4f1a\u8fc5\u901f\u6076\u5316\u3002C&#043;&#043; \u7684\u7f16\u8bd1\u3001\u94fe\u63a5\u770b\u4f3c\u7b80\u5355&#xff0c;\u5b9e\u9645\u4e0a\u76f8\u5f53\u7e41\u7410\u590d\u6742&#xff08;\u5177\u4f53\u539f\u7406\u53ef\u53c2\u8003\u300a\u6df1\u5165\u7406\u89e3\u8ba1\u7b97\u673a\u7cfb\u7edf&#xff08;\u7b2c\u4e09\u7248&#xff09;\u300b\u7b2c\u4e03\u7ae0&#xff09;&#xff1a;\u5934\u6587\u4ef6\u4f9d\u8d56\u3001\u9759\u6001\u5e93\/\u5171\u4eab\u5e93\u3001\u94fe\u63a5\u987a\u5e8f\u3001\u5e73\u53f0\u5dee\u5f02\u2026\u2026\u5982\u679c\u6ca1\u6709\u6784\u5efa\u5de5\u5177&#xff0c;\u5f00\u53d1\u4e00\u4e2a\u5927\u578b C&#043;&#043; \u9879\u76ee&#xff0c;\u4e00\u534a\u7684\u65f6\u95f4\u4f1a\u82b1\u5728\u7f16\u8bd1\u94fe\u63a5\u4e0a\u3002<\/p>\n<p>CMake \u6b63\u662f\u4e3a\u6b64\u800c\u751f&#xff1a;\u5b83\u4f7f\u7528\u7b80\u5355\u3001\u529f\u80fd\u5f3a\u5927&#xff0c;\u80fd\u81ea\u52a8\u751f\u6210 Makefile&#xff08;\u4e5f\u652f\u6301 Ninja \u7b49\u5176\u4ed6\u540e\u7aef&#xff09;&#xff0c;\u8ba9\u7a0b\u5e8f\u5458\u628a\u7cbe\u529b\u653e\u56de\u5199\u4ee3\u7801\u672c\u8eab\u3002\u5de5\u7a0b\u5316\u4e0d\u53ea\u89e3\u51b3&#034;\u600e\u4e48\u7f16\u8bd1&#034;&#xff0c;\u8fd8\u89e3\u51b3&#034;\u600e\u4e48\u4fdd\u8bc1\u4ee3\u7801\u8d28\u91cf&#034;\u2014\u2014\u8fd9\u5c31\u662f\u672c\u6587\u540e\u534a\u90e8\u5206 format\u3001cpplint\u3001clang-tidy \u4e09\u4e2a\u5de5\u5177\u5b58\u5728\u7684\u610f\u4e49\u3002<\/p>\n<h3>\u76ee\u5f55\u7ed3\u6784&#xff1a;\u6e90\u7801\u5e93\u4e0e\u6d4b\u8bd5\u7a0b\u5e8f\u5206\u79bb<\/h3>\n<p>day13 \u628a\u9879\u76ee\u62c6\u6210\u4e86\u4e09\u4e2a\u804c\u8d23\u6e05\u6670\u7684\u533a\u57df&#xff1a;<\/p>\n<ul>\n<li>src&#xff1a;\u6838\u5fc3\u7f51\u7edc\u5e93\u6e90\u7801&#xff08;.cpp \u5b9e\u73b0\u6587\u4ef6&#xff09;&#xff0c;\u672c\u8eab\u4e0d\u662f\u4e00\u4e2a\u53ef\u6267\u884c\u7a0b\u5e8f&#xff1b;<\/li>\n<li>src\/include&#xff1a;\u6240\u6709\u5934\u6587\u4ef6\u7edf\u4e00\u96c6\u4e2d\u5b58\u653e&#xff1b;<\/li>\n<li>test&#xff1a;\u4f7f\u7528\u7f51\u7edc\u5e93\u7f16\u5199\u7684\u6d4b\u8bd5\u7a0b\u5e8f&#xff08;server\u3001client \u7b49&#xff09;&#xff0c;\u6bcf\u4e2a .cpp \u7f16\u8bd1\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/li>\n<\/ul>\n<p>\u9876\u5c42 CMakeLists.txt \u4e2d\u901a\u8fc7\u5982\u4e0b\u65b9\u5f0f\u58f0\u660e\u5934\u6587\u4ef6\u641c\u7d22\u8def\u5f84&#xff1a;<\/p>\n<p>set(PINE_SRC_INCLUDE_DIR ${PROJECT_SOURCE_DIR}\/src\/include)<br \/>\nset(PINE_TEST_INCLUDE_DIR ${PROJECT_SOURCE_DIR}\/test\/include)<br \/>\ninclude_directories(${PINE_SRC_INCLUDE_DIR} ${PINE_TEST_INCLUDE_DIR})<\/p>\n<p>\u540c\u65f6&#xff0c;\u6839\u76ee\u5f55 CMakeLists \u4f1a\u62d2\u7edd\u5728\u9519\u8bef\u4f4d\u7f6e\u8fd0\u884c&#xff1a;\u5b83\u68c0\u67e5 ${PROJECT_BINARY_DIR}\/CMakeLists.txt \u662f\u5426\u5b58\u5728&#xff0c;\u5982\u679c\u5b58\u5728&#xff08;\u8bf4\u660e\u4f60\u5728\u9879\u76ee\u6839\u76ee\u5f55\u76f4\u63a5\u8dd1\u4e86 cmake&#xff09;\u5c31\u62a5\u9519\u63d0\u793a\u5fc5\u987b&#034;mkdir build; cd build; cmake ..&#034;&#xff0c;\u907f\u514d\u6c61\u67d3\u6e90\u7801\u76ee\u5f55\u3002<\/p>\n<h4>\u7f51\u7edc\u5e93\u7f16\u8bd1\u4e3a\u5171\u4eab\u5e93<\/h4>\n<p>src \u76ee\u5f55\u662f\u7f51\u7edc\u5e93&#xff0c;\u6ca1\u6709 main \u51fd\u6570&#xff0c;\u56e0\u6b64\u628a\u5b83\u6240\u6709 .cpp \u7f16\u8bd1\u94fe\u63a5\u6210\u4e00\u4e2a\u5171\u4eab\u5e93 libpine_shared&#xff0c;\u89c1 src\/CMakeLists.txt&#xff1a;<\/p>\n<p>file(GLOB_RECURSE pine_sources ${PROJECT_SOURCE_DIR}\/src\/*.cpp)<br \/>\nadd_library(pine_shared SHARED ${pine_sources})<\/p>\n<p>file(GLOB_RECURSE &#8230;) \u9012\u5f52\u6536\u96c6 src \u4e0b\u6240\u6709 .cpp&#xff0c;add_library(&#8230; SHARED &#8230;) \u751f\u6210\u5171\u4eab\u5e93&#xff0c;\u53ef\u88ab test \u76ee\u5f55\u4e0b\u7684\u53ef\u6267\u884c\u6587\u4ef6\u94fe\u63a5\u3002<\/p>\n<h4>\u6d4b\u8bd5\u7a0b\u5e8f\u9010\u4e2a\u7f16\u8bd1\u4e3a\u53ef\u6267\u884c\u6587\u4ef6<\/h4>\n<p>test\/CMakeLists.txt \u904d\u5386 test \u76ee\u5f55\u4e0b\u6bcf\u4e2a .cpp&#xff0c;\u7528\u6587\u4ef6\u540d&#xff08;\u53bb\u6389 .cpp \u540e\u7f00&#xff09;\u4f5c\u4e3a\u76ee\u6807\u540d\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6&#xff1a;<\/p>\n<p>foreach (pine_test_source ${PINE_TEST_SOURCES})<br \/>\n    get_filename_component(pine_test_filename ${pine_test_source} NAME)<br \/>\n    string(REPLACE &#034;.cpp&#034; &#034;&#034; pine_test_name ${pine_test_filename})<\/p>\n<p>    add_executable(${pine_test_name} EXCLUDE_FROM_ALL ${pine_test_source})<br \/>\n    add_dependencies(build-tests ${pine_test_name})<br \/>\n    add_dependencies(check-tests ${pine_test_name})<\/p>\n<p>    target_link_libraries(${pine_test_name} pine_shared)<\/p>\n<p>    set_target_properties(${pine_test_name}<br \/>\n        PROPERTIES<br \/>\n        RUNTIME_OUTPUT_DIRECTORY &#034;${CMAKE_BINARY_DIR}\/bin&#034;<br \/>\n        COMMAND ${pine_test_name}<br \/>\n    )<br \/>\nendforeach(pine_test_source ${PINE_TEST_SOURCES})<\/p>\n<p>\u51e0\u4e2a\u503c\u5f97\u6ce8\u610f\u7684\u7ec6\u8282&#xff1a;<\/p>\n<ul>\n<li>EXCLUDE_FROM_ALL \u610f\u5473\u7740\u8fd9\u4e9b\u53ef\u6267\u884c\u6587\u4ef6\u4e0d\u4f1a\u5728\u88f8 make \u65f6\u5168\u90e8\u6784\u5efa&#xff0c;\u800c\u662f\u6309\u9700\u7528 make server \u7b49\u663e\u5f0f\u76ee\u6807\u540d\u5355\u72ec\u7f16\u8bd1&#xff1b;<\/li>\n<li>\u6bcf\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u90fd\u901a\u8fc7 target_link_libraries \u94fe\u63a5 pine_shared \u5171\u4eab\u5e93&#xff1b;<\/li>\n<li>RUNTIME_OUTPUT_DIRECTORY \u628a\u4ea7\u7269\u7edf\u4e00\u8f93\u51fa\u5230 build\/bin&#xff1b;<\/li>\n<li>build-tests \/ check-tests \u4e24\u4e2a\u81ea\u5b9a\u4e49\u76ee\u6807\u628a\u5b83\u4eec\u4e32\u8d77\u6765&#xff0c;\u65b9\u4fbf\u6279\u91cf\u6784\u5efa\u4e0e\u8fd0\u884c\u3002<\/li>\n<\/ul>\n<p>\u9876\u5c42 CMakeLists \u8fd8\u5b9a\u4e49\u4e86\u4ea7\u7269\u76ee\u5f55\u4e0e\u7f16\u8bd1\u9009\u9879&#xff1a;<\/p>\n<p>set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}\/lib)<br \/>\nset(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}\/lib)<br \/>\nset(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}\/bin)<\/p>\n<p>\u5171\u4eab\u5e93\u6700\u7ec8\u4f1a\u843d\u5728 build\/lib \u4e2d&#xff0c;\u800c\u53ef\u6267\u884c\u6587\u4ef6\u5728 build\/bin\u3002<\/p>\n<h3>\u6309\u73af\u5883\u5b9a\u5236\u7f16\u8bd1\u53c2\u6570<\/h3>\n<p>\u4e0d\u540c\u73af\u5883\u4e0b\u7684\u7f16\u8bd1\u53c2\u6570\u5728 CMake \u4e2d\u7edf\u4e00\u7ba1\u7406&#xff0c;\u89c1 CMakeLists.txt&#xff1a;<\/p>\n<p>set(CMAKE_CXX_FLAGS &#034;${CMAKE_CXX_FLAGS} -fPIC -Wall -Wextra -std&#061;c&#043;&#043;17 -pthread&#034;)<br \/>\nset(CMAKE_CXX_FLAGS &#034;${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-attributes&#034;) #TODO: remove<br \/>\nset(CMAKE_CXX_FLAGS_DEBUG &#034;${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb -fsanitize&#061;address -fno-omit-frame-pointer -fno-optimize-sibling-calls&#034;)<br \/>\nset(CMAKE_EXE_LINKER_FLAGS  &#034;${CMAKE_EXE_LINKER_FLAGS} -fPIC&#034;)<br \/>\nset(CMAKE_SHARED_LINKER_FLAGS &#034;${CMAKE_SHARED_LINKER_FLAGS} -fPIC&#034;)<br \/>\nset(CMAKE_STATIC_LINKER_FLAGS &#034;${CMAKE_STATIC_LINKER_FLAGS} -fPIC&#034;)<\/p>\n<ul>\n<li>-std&#061;c&#043;&#043;17&#xff1a;\u542f\u7528 C&#043;&#043;17 \u6807\u51c6&#xff1b;<\/li>\n<li>-fPIC&#xff1a;\u751f\u6210\u4f4d\u7f6e\u65e0\u5173\u4ee3\u7801&#xff0c;\u662f\u7f16\u8bd1\u5171\u4eab\u5e93\u7684\u5fc5\u5907\u9009\u9879&#xff0c;\u8fd9\u91cc\u540c\u65f6\u7ed9\u53ef\u6267\u884c\u6587\u4ef6\u3001\u5171\u4eab\u5e93\u3001\u9759\u6001\u5e93\u7684\u94fe\u63a5\u90fd\u8865\u4e0a\u4e86&#xff1b;<\/li>\n<li>-Wall -Wextra&#xff1a;\u5f00\u542f\u5e38\u89c1\u8b66\u544a&#xff1b;-Wno-unused-parameter -Wno-attributes \u6682\u65f6\u5c4f\u853d\u4e24\u7c7b\u566a\u97f3\u8b66\u544a&#xff08;\u6e90\u7801\u6ce8\u91ca\u6807\u8bb0\u4e86 #TODO: remove&#xff0c;\u7b49\u4ee3\u7801\u6e05\u7406\u5e72\u51c0\u540e\u5e94\u79fb\u9664&#xff09;&#xff1b;<\/li>\n<li>-pthread&#xff1a;\u542f\u7528\u7ebf\u7a0b\u652f\u6301&#xff0c;day12 \u5f15\u5165\u7ebf\u7a0b\u6c60\u540e\u5fc5\u987b&#xff1b;<\/li>\n<li>Debug \u6a21\u5f0f\u4e0b\u8ffd\u52a0 -O0 -ggdb -fsanitize&#061;address -fno-omit-frame-pointer -fno-optimize-sibling-calls&#xff1a;\u5173\u95ed\u4f18\u5316\u3001\u751f\u6210\u8c03\u8bd5\u4fe1\u606f&#xff0c;\u5e76\u5f00\u542f AddressSanitizer&#xff08;\u5185\u5b58\u9519\u8bef\u68c0\u6d4b&#xff09;&#xff0c;\u540c\u65f6\u4fdd\u7559\u5b8c\u6574\u8c03\u7528\u6808&#xff0c;\u65b9\u4fbf\u5b9a\u4f4d\u5185\u5b58\u8d8a\u754c\u3001\u6cc4\u6f0f\u7b49\u95ee\u9898\u3002<\/li>\n<\/ul>\n<h4>\u5207\u6362\u5230 clang \u7f16\u8bd1\u5668<\/h4>\n<p>\u6ce8\u610f&#xff1a;\u672c\u7248\u672c\u8d77\u7f16\u8bd1\u5668\u4ece GCC \u5207\u6362\u5230\u4e86\u66f4\u5f3a\u5927\u3001\u66f4\u597d\u7528\u7684 clang\u3002clang \u7684\u7f16\u8bd1\u9519\u8bef\u4e0e\u8b66\u544a\u4fe1\u606f\u66f4\u6e05\u6670&#xff0c;\u5e76\u4e14\u5b83\u7684\u914d\u5957\u5de5\u5177\u94fe&#xff08;clang-format\u3001clang-tidy&#xff09;\u6b63\u662f\u672c\u65e5\u5de5\u7a0b\u5316\u4e09\u4ef6\u5957\u7684\u6838\u5fc3\u3002CMake \u901a\u8fc7 find_program \u5728\u82e5\u5e72\u5e38\u89c1\u8def\u5f84\u4e2d\u81ea\u52a8\u67e5\u627e clang-format\u3001clang-tidy&#xff08;\u89c1\u9876\u5c42 CMakeLists \u7684 PINE_CLANG_SEARCH_PATH&#xff0c;\u8986\u76d6 \/usr\/local\/bin\u3001\/usr\/bin \u4ee5\u53ca llvm \u76f8\u5173\u8def\u5f84&#xff09;&#xff0c;\u627e\u4e0d\u5230\u65f6\u53ea\u7ed9\u51fa WARNING \u800c\u4e0d\u4e2d\u65ad\u914d\u7f6e&#xff0c;\u4fdd\u8bc1\u7075\u6d3b\u6027\u3002<\/p>\n<h3>\u4e09\u4ef6\u5957&#xff1a;format\u3001cpplint\u3001clang-tidy<\/h3>\n<p>\u914d\u7f6e\u597d CMake \u548c clang \u540e&#xff0c;\u8fd8\u9700\u8981\u505a\u4e09\u4ef6\u4e8b&#xff0c;\u5b83\u4eec\u5171\u540c\u4fdd\u8bc1\u5199\u51fa&#034;\u98ce\u683c\u4e00\u81f4\u3001bug \u8f83\u5c11\u3001\u6027\u80fd\u8f83\u597d\u3001\u9075\u5b88 google \u7f16\u7801\u89c4\u8303&#034;\u7684\u9879\u76ee&#xff1a;<\/p>\n<li>format&#xff08;clang-format&#xff09;&#xff1a;\u5927\u578b C&#043;&#043; \u9879\u76ee\u5f80\u5f80\u591a\u4eba\u534f\u4f5c&#xff0c;\u6bcf\u4e2a\u4eba\u7f16\u7801\u4e60\u60ef\u4e0d\u540c&#xff0c;\u4ee3\u7801\u98ce\u683c\u4f1a\u6742\u4e71\u65e0\u7ae0\u3002\u7528 clang-format \u5f3a\u5236\u7edf\u4e00\u98ce\u683c\u3002\u76ee\u524d\u6d41\u884c\u7684\u98ce\u683c\u6709 google\u3001llvm \u7b49&#xff0c;\u672c\u9879\u76ee\u91c7\u7528 google \u98ce\u683c&#xff0c;\u5177\u4f53\u914d\u7f6e\u5728 .clang-format&#xff1a; BasedOnStyle: Google<br \/>\nDerivePointerAlignment: false<br \/>\nPointerAlignment: Right<br \/>\nColumnLimit: 120<br \/>\nIncludeBlocks: Preserve<\/p>\n<p>\u5373\u5728 Google \u98ce\u683c\u57fa\u7840\u4e0a&#xff0c;\u6307\u9488\u9760\u53f3\u5bf9\u9f50\u3001\u5355\u884c\u4e0a\u9650 120 \u5217&#xff08;\u5bf9\u5e94 cpplint \u7684 &#8211;linelength&#061;120&#xff09;\u3001\u4fdd\u7559 include \u5757\u7684\u539f\u59cb\u987a\u5e8f\u3002<\/p>\n<\/li>\n<li>cpplint&#xff1a;\u57fa\u4e8e google C&#043;&#043; \u7f16\u7801\u89c4\u8303\u7684\u9759\u6001\u4ee3\u7801\u5206\u6790\u5de5\u5177&#xff0c;\u53ef\u4ee5\u67e5\u627e\u4ee3\u7801\u4e2d\u8fdd\u53cd\u7ea6\u5b9a\u3001\u6709\u9690\u60a3\u3001\u5efa\u8bae\u4fee\u6539\u7684\u5730\u65b9\u3002\u4ed3\u5e93\u81ea\u5e26\u4e86 build_support\/cpplint.py\u3002<\/li>\n<li>clang-tidy&#xff1a;clang \u7f16\u8bd1\u5668\u7684\u4ee3\u7801\u5206\u6790\u5de5\u5177&#xff0c;\u529f\u80fd\u5341\u5206\u5f3a\u5927\u3002\u65e2\u80fd\u67e5\u627e\u4ee3\u7801\u4e2d\u7684\u9759\u6001\u9519\u8bef&#xff0c;\u4e5f\u80fd\u63d0\u793a\u53ef\u80fd\u5728\u8fd0\u884c\u65f6\u53d1\u751f\u7684\u95ee\u9898&#xff0c;\u8fd8\u80fd\u901a\u8fc7\u4ee3\u7801\u5206\u6790\u7ed9\u51fa\u63d0\u5347\u7a0b\u5e8f\u6027\u80fd\u7684\u5efa\u8bae&#xff08;\u5982\u6309\u503c\u4f20\u53c2\u6539\u4e3a\u5f15\u7528\u4f20\u53c2\u4ee5\u51cf\u5c11\u62f7\u8d1d&#xff09;\u3002<\/li>\n<p>\u8fd9\u4e09\u4e2a\u5de5\u5177\u90fd\u4ee5 python \u811a\u672c\u7684\u5f62\u5f0f\u4fdd\u5b58\u5728 build_support \u76ee\u5f55&#xff0c;\u53ef\u4ee5\u4e00\u952e\u81ea\u52a8\u8fd0\u884c&#xff1a;<\/p>\n<p>build_support<br \/>\n    &#8211; clang_format_exclusions.txt     \/\/ \u4e0d\u9700\u8981\u683c\u5f0f\u5316\u7684\u4ee3\u7801<br \/>\n    &#8211; run_clang_format.py             \/\/ format<br \/>\n    &#8211; cpplint.py                      \/\/ cpplint<br \/>\n    &#8211; run_clang_tidy_extra.py         \/\/ \u5e2e\u52a9\u6587\u4ef6&#xff0c;\u4e0d\u76f4\u63a5\u8fd0\u884c<br \/>\n    &#8211; run_clang_tidy.py               \/\/ clang-tidy<br \/>\n.clang-format                         \/\/ format\u914d\u7f6e<br \/>\n.clang-tidy                           \/\/ clang-tidy\u914d\u7f6e<\/p>\n<h4>\u4e09\u4e2a\u5de5\u5177\u5728 CMake \u4e2d\u7684\u96c6\u6210\u65b9\u5f0f<\/h4>\n<p>format&#xff1a;make format \u8c03\u7528 run_clang_format.py&#xff0c;\u5bf9 src \u548c test \u4e0b\u7684\u6e90\u7801\u5c31\u5730\u91cd\u6392\u683c\u5f0f&#xff08;&#8211;fix&#xff09;&#xff0c;\u5e76\u8df3\u8fc7 clang_format_exclusions.txt \u4e2d\u5217\u51fa\u7684\u6587\u4ef6&#xff1a;<\/p>\n<p>add_custom_target(format ${PINE_BUILD_SUPPORT_DIR}\/run_clang_format.py<br \/>\n        ${CLANG_FORMAT_BIN}<br \/>\n        ${PINE_BUILD_SUPPORT_DIR}\/clang_format_exclusions.txt<br \/>\n        &#8211;source_dirs<br \/>\n        ${PINE_FORMAT_DIRS}<br \/>\n        &#8211;fix<br \/>\n        &#8211;quiet<br \/>\n        )<\/p>\n<p>\u4ece\u811a\u672c\u6e90\u7801\u53ef\u4ee5\u770b\u51fa\u5b83\u7684\u5de5\u4f5c\u65b9\u5f0f&#xff1a;\u904d\u5386 &#8211;source_dirs \u4e0b\u6240\u6709 .h\/.cpp \u6587\u4ef6&#xff0c;\u5254\u9664\u5339\u914d\u6392\u9664 glob \u7684\u6587\u4ef6&#xff1b;\u5e26 &#8211;fix \u65f6\u8c03\u7528 clang-format -i \u76f4\u63a5\u6539\u5199\u6587\u4ef6&#xff1b;\u4e0d\u5e26 &#8211;fix&#xff08;\u5373 make check-format&#xff09;\u65f6\u5219\u9010\u4e2a\u6bd4\u5bf9\u683c\u5f0f\u5316\u524d\u540e\u7684 diff&#xff0c;\u5982\u6709\u5dee\u5f02\u4ee5\u975e\u96f6\u9000\u51fa\u7801\u62a5\u544a\u3002${PINE_FORMAT_DIRS} \u7528 string(CONCAT &#8230;) \u62fc\u63a5\u4e3a src,test \u9017\u53f7\u5206\u9694\u5f62\u5f0f\u4f20\u5165\u811a\u672c\u3002<\/p>\n<p>cpplint&#xff1a;make cpplint \u5148\u9012\u5f52\u6536\u96c6 src \u4e0e test \u4e0b\u6240\u6709 .h\/.cpp \u4f5c\u4e3a\u68c0\u67e5\u5bf9\u8c61&#xff0c;\u518d\u901a\u8fc7\u7ba1\u9053\u5206\u53d1\u7ed9 cpplint \u5e76\u884c\u6267\u884c&#xff1a;<\/p>\n<p>add_custom_target(cpplint echo &#039;${PINE_LINT_FILES}&#039; | xargs -n12 -P8<br \/>\n        ${CPPLINT_BIN}<br \/>\n        &#8211;verbose&#061;2 &#8211;quiet<br \/>\n        &#8211;linelength&#061;120<br \/>\n        &#8211;filter&#061;-legal\/copyright,-build\/include_subdir,-readability\/casting<br \/>\n        )<\/p>\n<p>\u53c2\u6570\u542b\u4e49&#xff1a;xargs -n12 -P8 \u6bcf 12 \u4e2a\u6587\u4ef6\u4e00\u6279\u3001\u6700\u591a 8 \u4e2a\u8fdb\u7a0b\u5e76\u884c&#xff0c;\u517c\u987e\u542f\u52a8\u5f00\u9500\u4e0e\u5e76\u53d1\u5ea6&#xff1b;&#8211;verbose&#061;2 \u8f93\u51fa\u8be6\u7ec6\u4fe1\u606f&#xff1b;&#8211;linelength&#061;120 \u4e0e clang-format \u7684 120 \u5217\u4fdd\u6301\u4e00\u81f4&#xff1b;&#8211;filter \u5173\u95ed\u4e86\u7248\u6743\u5934\u3001\u5b50\u76ee\u5f55 include \u8def\u5f84\u3001casting \u53ef\u8bfb\u6027\u4e09\u7c7b\u4e0e\u672c\u9879\u76ee\u65e0\u5173\u7684\u68c0\u67e5\u9879\u3002<\/p>\n<p>clang-tidy&#xff1a;make clang-tidy \u8c03\u7528 LLVM \u5b98\u65b9 run_clang_tidy.py \u811a\u672c&#xff0c;\u501f\u52a9 CMake \u751f\u6210\u7684 compile_commands.json&#xff08;CMAKE_EXPORT_COMPILE_COMMANDS&#xff09;\u83b7\u5f97\u6bcf\u4e2a\u6587\u4ef6\u7684\u771f\u5b9e\u7f16\u8bd1\u53c2\u6570&#xff1a;<\/p>\n<p>add_custom_target(clang-tidy<br \/>\n        ${PINE_BUILD_SUPPORT_DIR}\/run_clang_tidy.py<br \/>\n        -clang-tidy-binary ${CLANG_TIDY_BIN}<br \/>\n        -p ${CMAKE_BINARY_DIR}<br \/>\n        )<\/p>\n<p>clang-tidy \u4f1a\u81ea\u52a8\u5411\u4e0a\u67e5\u627e\u7236\u76ee\u5f55\u4e2d\u7684 .clang-tidy \u914d\u7f6e\u6587\u4ef6\u3002\u672c\u9879\u76ee\u7684 .clang-tidy \u542f\u7528\u4e86\u5927\u91cf\u68c0\u67e5\u7ec4&#xff1a;bugprone-*&#xff08;\u6613\u9519\u70b9&#xff09;\u3001clang-analyzer-*&#xff08;\u9759\u6001\u5206\u6790\u5668&#xff09;\u3001concurrency-*&#xff08;\u5e76\u53d1\u95ee\u9898&#xff09;\u3001cppcoreguidelines-*\u3001google-*\u3001hicpp-*\u3001modernize-*&#xff08;\u73b0\u4ee3 C&#043;&#043; \u98ce\u683c\u6539\u9020&#xff09;\u3001performance-*&#xff08;\u6027\u80fd\u5efa\u8bae&#xff09;\u3001portability-*\u3001readability-*&#xff08;\u53ef\u8bfb\u6027&#xff09;&#xff0c;\u5e76\u9488\u5bf9\u672c\u7f51\u7edc\u5e93\u7684\u5b9e\u9645\u60c5\u51b5\u7981\u7528\u4e86\u82e5\u5e72\u89c4\u5219&#xff08;\u5982 magic numbers\u3001C \u6570\u7ec4\u3001vararg\u3001\u663e\u5f0f\u8f6c\u578b\u7b49&#xff09;&#xff0c;\u540c\u65f6\u901a\u8fc7 CheckOptions \u5f3a\u5236\u547d\u540d\u89c4\u8303&#xff1a;\u7c7b\/\u679a\u4e3e\/\u51fd\u6570\u7528 CamelCase\u3001\u6210\u5458\u53d8\u91cf\u7528\u5c0f\u5199\u52a0 _ \u540e\u7f00\u3001\u5168\u5c40\u5e38\u91cf\u7528 UPPER_CASE \u7b49\u3002WarningsAsErrors: &#039;*&#039; \u628a\u4e00\u5207\u8b66\u544a\u5347\u7ea7\u4e3a\u9519\u8bef&#xff0c;\u4fdd\u8bc1 make clang-tidy \u4e00\u65e6\u6709\u544a\u8b66\u5c31\u5931\u8d25&#xff0c;\u8feb\u4f7f\u95ee\u9898\u88ab\u7acb\u5373\u4fee\u590d\u3002<\/p>\n<h3>\u5b8c\u6574\u6784\u5efa\u6d41\u7a0b&#xff1a;\u4ece\u96f6\u7f16\u8bd1\u670d\u52a1\u5668<\/h3>\n<p>\u6574\u5957\u6d41\u7a0b\u5728\u4ed3\u5e93\u4e2d\u53ef\u5b8c\u6574\u590d\u73b0&#xff1a;<\/p>\n<p>mkdir build<br \/>\ncd build<br \/>\ncmake ..<\/p>\n<p>\u7528 CMake \u751f\u6210 Makefile\u3002\u7136\u540e\u4f9d\u6b21\u6267\u884c\u4e09\u4e2a\u8d28\u91cf\u68c0\u67e5&#xff08;\u5c06\u8b66\u544a\u5168\u90e8\u4fee\u6539\u597d\u540e&#xff0c;\u91cd\u65b0\u8fd0\u884c\u76f4\u5230\u5168\u90e8\u901a\u8fc7&#xff09;&#xff1a;<\/p>\n<p>make format          # \u4ee3\u7801\u683c\u5f0f\u5316<br \/>\nmake cpplint         # google \u89c4\u8303\u9759\u6001\u68c0\u67e5<br \/>\nmake clang-tidy      # clang \u6df1\u5ea6\u4ee3\u7801\u5206\u6790<\/p>\n<p>\u5168\u90e8\u901a\u8fc7\u540e&#xff0c;\u7f16\u8bd1\u6574\u4e2a\u7f51\u7edc\u5e93&#xff08;\u5171\u4eab\u5e93\u4f1a\u4fdd\u5b58\u5230 lib \u6587\u4ef6\u5939\u4e2d&#xff0c;\u6b64\u6b65\u4e0d\u4ea7\u751f\u53ef\u6267\u884c\u6587\u4ef6&#xff09;\u3002\u9700\u8981\u53ef\u6267\u884c\u7a0b\u5e8f\u65f6&#xff0c;\u6309\u76ee\u6807\u540d\u7f16\u8bd1 test \u76ee\u5f55\u4e0b\u7684\u5bf9\u5e94\u6e90\u6587\u4ef6&#xff1a;<\/p>\n<p>make server<br \/>\nmake multiple_client<br \/>\nmake single_client<\/p>\n<p>\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u4f4d\u4e8e build\/bin \u76ee\u5f55\u4e0b&#xff08;\u6ce8\u610f&#xff1a;\u6587\u6863\u4e2d\u63cf\u8ff0\u7684 build\/test \u76ee\u5f55\u5bf9\u5e94\u65e7\u7248\u672c\u5e03\u5c40&#xff0c;\u672c\u4ed3\u5e93\u7684 RUNTIME_OUTPUT_DIRECTORY \u7edf\u4e00\u4e3a build\/bin&#xff09;&#xff0c;\u6b64\u65f6\u8fd0\u884c .\/bin\/server \u5373\u53ef\u542f\u52a8\u670d\u52a1\u5668\u3002\u4ee5 test\/server.cpp \u4e3a\u4f8b&#xff0c;\u5b83\u7684 main \u53ea\u505a\u4e86\u56db\u4ef6\u4e8b&#xff1a;\u521b\u5efa EventLoop\u3001\u521b\u5efa Server\u3001\u8fdb\u5165 loop-&gt;Loop() \u4e8b\u4ef6\u5faa\u73af\u3001\u9000\u51fa\u65f6\u91ca\u653e\u5bf9\u8c61\u2014\u2014\u4e1a\u52a1\u903b\u8f91\u5168\u90e8\u5c01\u88c5\u5728\u7f51\u7edc\u5e93\u5185\u90e8\u3002<\/p>\n<h3>\u5de5\u7a0b\u5316\u7684\u5b9e\u9645\u6536\u76ca&#xff1a;\u4ee3\u7801\u5ba1\u67e5\u9a71\u52a8\u7684\u91cd\u6784<\/h3>\n<p>\u4eca\u5929\u4e0d\u4ec5\u5b8c\u6210\u4e86&#034;\u5de5\u5177\u94fe&#034;\u5c42\u9762\u7684\u5de5\u7a0b\u5316&#xff0c;\u8fd9\u4e9b\u5de5\u5177\u7ed9\u51fa\u7684\u5efa\u8bae\u4e5f\u76f4\u63a5\u63a8\u52a8\u4e86\u4ee3\u7801\u8d28\u91cf\u63d0\u5347&#xff1a;<\/p>\n<li>\u4ee3\u7801\u98ce\u683c\u7edf\u4e00\u4e3a google-style&#xff0c;\u914d\u5408 .clang-tidy \u7684\u547d\u540d\u89c4\u8303\u68c0\u67e5&#xff0c;\u6574\u4e2a\u9879\u76ee\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u663e\u8457\u63d0\u9ad8&#xff1b;<\/li>\n<li>\u4fee\u590d\u4e86\u4e4b\u524d\u7248\u672c\u7684\u8bb8\u591a bug&#xff0c;\u5e76\u5e94\u7528\u4e86\u73b0\u4ee3 C&#043;&#043; \u9879\u76ee\u5efa\u8bae&#xff1b;<\/li>\n<li>\u6240\u6709\u7c7b\u90fd\u58f0\u660e\u4e3a\u4e0d\u53ef\u62f7\u8d1d\u3001\u4e0d\u53ef\u79fb\u52a8\u3002\u8fd9\u901a\u8fc7 src\/include\/Macros.h \u4e2d\u7684\u5b8f\u5b9e\u73b0&#xff1a; #define DISALLOW_COPY(cname)                             \\\\<br \/>\n  cname(const cname &amp;) &#061; delete;            \/* NOLINT *\/ \\\\<br \/>\n  cname &amp;operator&#061;(const cname &amp;) &#061; delete; \/* NOLINT *\/<\/p>\n<p>#define DISALLOW_MOVE(cname)                        \\\\<br \/>\n  cname(cname &amp;&amp;) &#061; delete;            \/* NOLINT *\/ \\\\<br \/>\n  cname &amp;operator&#061;(cname &amp;&amp;) &#061; delete; \/* NOLINT *\/<\/p>\n<p>#define DISALLOW_COPY_AND_MOVE(cname) \\\\<br \/>\n  DISALLOW_COPY(cname);               \\\\<br \/>\n  DISALLOW_MOVE(cname);<\/p>\n<p>\u50cf Channel\u3001EventLoop\u3001Epoll\u3001Server \u7b49\u6301\u6709 fd\u3001epoll \u5b9e\u4f8b\u7b49\u72ec\u5360\u8d44\u6e90\u7684\u7c7b&#xff0c;\u90fd\u5728\u5934\u6587\u4ef6\u4e2d\u4ee5 DISALLOW_COPY_AND_MOVE(Channel); \u5f62\u5f0f\u7981\u7528\u62f7\u8d1d\u4e0e\u79fb\u52a8&#xff0c;\u4ece\u8bed\u8a00\u5c42\u9762\u675c\u7edd\u4e86\u8d44\u6e90\u7684\u610f\u5916\u590d\u5236\u4e0e\u60ac\u5782\u95ee\u9898\u3002clang-tidy \u7684 cppcoreguidelines-*\u3001hicpp-* \u68c0\u67e5\u7ec4\u6b63\u662f\u8fd9\u7c7b\u89c4\u5219\u7684\u4e3b\u8981\u6765\u6e90\u3002<\/p>\n<\/li>\n<li>\u6309\u503c\u4f20\u53c2\u88ab\u4fee\u6539\u4e3a\u5f15\u7528\u4f20\u53c2&#xff08;\u5982 Channel.h \u4e2d void SetReadCallback(std::function&lt;void()&gt; const &amp;callback); \u4f7f\u7528 const &amp; \u800c\u975e\u503c\u4f20\u9012&#xff09;&#xff0c;\u51cf\u5c11\u4e86\u5927\u91cf\u7684\u590d\u5236\u64cd\u4f5c&#xff0c;\u76f4\u63a5\u964d\u4f4e\u4e86\u670d\u52a1\u5668\u5728\u56de\u8c03\u6ce8\u518c\u3001\u4e8b\u4ef6\u5206\u53d1\u8def\u5f84\u4e0a\u7684\u62f7\u8d1d\u5f00\u9500\u3002<\/li>\n<p>\u53ef\u4ee5\u770b\u5230&#xff0c;performance-*\u3001modernize-* \u8fd9\u7c7b\u68c0\u67e5\u4e0d\u4ec5\u662f\u5728&#034;\u6311\u6bdb\u75c5&#034;&#xff0c;\u8fd8\u80fd\u7ed9\u51fa\u5177\u4f53\u7684\u6027\u80fd\u4f18\u5316\u65b9\u5411\u3002\u867d\u7136\u76ee\u524d\u8fd8\u6ca1\u6709\u4f7f\u7528\u4e13\u95e8\u7684\u6027\u80fd\u6d4b\u8bd5\u5de5\u5177&#xff0c;\u4f46\u5904\u7406\u901f\u5ea6\u3001\u541e\u5410\u91cf\u3001\u5e76\u53d1\u652f\u6301\u5ea6\u90fd\u56e0\u4e3a\u8fd9\u4e9b\u6539\u52a8\u800c\u660e\u663e\u63d0\u9ad8\u2014\u2014\u800c\u8fd9\u6b63\u662f\u4ece&#034;\u80fd\u8dd1\u7684\u670d\u52a1\u5668&#034;\u8d70\u5411&#034;\u5de5\u7a0b\u5316\u7684\u670d\u52a1\u5668&#034;\u7684\u5173\u952e\u4e00\u6b65\u3002<\/p>\n<h3>\u5c0f\u7ed3<\/h3>\n<p>day13 \u5b8c\u6210\u4e86\u4e09\u4ef6\u4e8b&#xff1a;\u7528 CMake \u91cd\u6784\u4e86\u6574\u4e2a\u9879\u76ee\u7684\u6784\u5efa\u7cfb\u7edf&#xff08;\u6e90\u7801\u5e93\u4e0e\u6d4b\u8bd5\u5206\u79bb\u3001\u7f51\u7edc\u5e93\u7f16\u8bd1\u4e3a\u5171\u4eab\u5e93\u3001\u6d4b\u8bd5\u6309\u9700\u7f16\u8bd1&#xff09;&#xff1b;\u4ece GCC \u5207\u6362\u5230 clang \u5e76\u914d\u7f6e\u4e86\u5206\u73af\u5883\u7684\u7f16\u8bd1\u53c2\u6570&#xff1b;\u5f15\u5165 clang-format\u3001cpplint\u3001clang-tidy \u4e09\u4ef6\u5957\u5e76\u96c6\u6210\u8fdb make format\u3001make cpplint\u3001make clang-tidy \u4e00\u952e\u76ee\u6807\u3002\u7531\u6b64\u5e26\u6765\u7684 google-style \u98ce\u683c\u7edf\u4e00\u3001\u4e0d\u53ef\u62f7\u8d1d\/\u4e0d\u53ef\u79fb\u52a8\u7684\u7c7b\u8bbe\u8ba1\u3001\u5f15\u7528\u4f20\u53c2\u4f18\u5316&#xff0c;\u65e2\u51cf\u5c11\u4e86 bug \u6982\u7387\u53c8\u63d0\u5347\u4e86\u670d\u52a1\u5668\u6027\u80fd\u3002\u8fd9\u5957&#034;\u6784\u5efa &#043; \u9759\u6001\u68c0\u67e5 &#043; \u6df1\u5ea6\u5206\u6790&#034;\u7684\u5de5\u7a0b\u5316\u7ec4\u5408&#xff0c;\u4e5f\u662f\u540e\u7eed day14&#xff5e;day16 \u5728\u7ec6\u8282\u4e0a\u7ee7\u7eed\u6f14\u8fdb&#xff08;\u652f\u6301\u4e1a\u52a1\u903b\u8f91\u81ea\u5b9a\u4e49\u3001\u8de8\u5e73\u53f0\u9002\u914d\u3001\u667a\u80fd\u6307\u9488\u91cd\u6784&#xff09;\u7684\u57fa\u7840\u8bbe\u65bd\u4fdd\u969c\u3002<\/p>\n<p>\u60f3\u8981\u6df1\u5165\u7406\u89e3\u6bcf\u4e2a\u5de5\u5177\u7684\u5177\u4f53\u884c\u4e3a&#xff0c;\u53ef\u4ee5\u7ee7\u7eed\u9605\u8bfb\u4ed3\u5e93\u4e2d\u7684 \u9876\u5c42 CMakeLists.txt\u3001.clang-format\u3001.clang-tidy \u4ee5\u53ca build_support \u76ee\u5f55\u4e0b\u7684\u811a\u672c\u6e90\u7801\u3002<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" class=\"gcb-icon-like\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011040857-6acb0bd9dcc29.svg\" alt=\"\" width=\"16\" height=\"16\" \/> <span class=\"gcb-like-text\">\u8d5e<\/span>  <\/p>\n<p>   <span class=\"gcb-share-text\">\u5206\u4eab<\/span>  <\/p>\n<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u793a\u4f8b\u5de5\u7a0b<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u301130dayMakeCppServer<\/h3>\n<p class=\"gcb-project-desc\">30\u5929\u81ea\u5236C&#043;&#043;\u670d\u52a1\u5668&#xff0c;\u5305\u542b\u6559\u7a0b\u548c\u6e90\u4ee3\u7801<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/GitHub_Trending\/30\/30dayMakeCppServer<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<h4 class=\"gcb-related-title\">\u76f8\u5173\u63a8\u8350<\/h4>\n<ul class=\"gcb-related-list\">\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">30\u5929\u81ea\u5236C&#043;&#043;\u670d\u52a1\u5668&#xff1a;Clang-Tidy\u9759\u6001\u4ee3\u7801\u5206\u6790\u7ec8\u6781\u6307\u5357 &#x1f680;<\/h5>\n<p class=\"gcb-related-item-desc\">30\u5929\u81ea\u5236C&#043;&#043;\u670d\u52a1\u5668&#xff1a;Clang Tidy\u9759\u6001\u4ee3\u7801\u5206\u6790\u7ec8\u6781\u6307\u5357 &#x1f680; \u572830\u5929\u81ea\u5236C&#043;&#043;\u670d\u52a1\u5668\u9879\u76ee\u4e2d&#xff0c; Clang Tidy\u9759\u6001\u4ee3\u7801\u5206\u6790 \u662f\u786e\u4fdd\u4ee3\u7801\u8d28\u91cf\u7684\u5173\u952e<\/p>\n<p>     <span class=\"gcb-tag\">\u793a\u4f8b\u5de5\u7a0b<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\"> Phabricator\u4ee3\u7801\u8d28\u91cf\u5de5\u5177\u96c6\u6210&#xff1a;Clang-Tidy\u4e0eESLint\u81ea\u52a8\u5316\u914d\u7f6e<\/h5>\n<p class=\"gcb-related-item-desc\">Phabricator\u4ee3\u7801\u8d28\u91cf\u5de5\u5177\u96c6\u6210&#xff1a;Clang Tidy\u4e0eESLint\u81ea\u52a8\u5316\u914d\u7f6e \u4f60\u662f\u5426\u8fd8\u5728\u4e3a\u4ee3\u7801\u63d0\u4ea4\u524d\u7684\u8d28\u91cf\u68c0\u67e5\u7e41\u7410\u6d41\u7a0b\u800c\u56f0\u6270&#xff1f;\u662f\u5426\u5e0c\u671b\u6bcf\u6b21\u4ee3\u7801\u53d8\u66f4\u90fd\u80fd\u81ea<\/p>\n<p>     <span class=\"gcb-tag\">\u540e\u7aef<\/span><br \/>\n     <span class=\"gcb-tag\">\u5f00\u53d1\u5de5\u5177<\/span><br \/>\n     <span class=\"gcb-tag\">\u7814\u53d1\u534f\u4f5c<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">\u7ec8\u6781C&#043;&#043;\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u4ee3\u7801\u8d28\u91cf\u6307\u5357&#xff1a;Tiny-DNN\u7684clang-format\u548ccpplint\u6700\u4f73\u5b9e\u8df5<\/h5>\n<p class=\"gcb-related-item-desc\">\u7ec8\u6781C&#043;&#043;\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u4ee3\u7801\u8d28\u91cf\u6307\u5357&#xff1a;Tiny DNN\u7684clang format\u548ccpplint\u6700\u4f73\u5b9e\u8df5 Tiny DNN\u4f5c\u4e3a\u4e00\u4e2aheader only\u3001\u65e0\u4f9d\u8d56\u7684<\/p>\n<p>     <span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span><br \/>\n     <span class=\"gcb-tag\">\u6df1\u5ea6\u5b66\u4e60<\/span><br \/>\n     <span class=\"gcb-tag\">\u5d4c\u5165\u5f0f<\/span>\n      <\/li>\n<\/ul>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0a\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  \u673a\u5668\u5b66\u4e60\u63a8\u7406\u7cfb\u7edf\u5b9e\u6218\u6307\u5357&#xff1a;\u4ece\u57fa\u51c6\u6d4b\u8bd5\u5230\u751f\u4ea7\u90e8\u7f72 <\/p>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0b\u4e00\u7bc7&#xff1a;<\/span><br \/>\n   Livox-SDK2\u6fc0\u5149\u96f7\u8fbe\u5f00\u53d1\u7ec8\u6781\u6307\u5357&#xff1a;\u4ece\u96f6\u5f00\u59cb\u7684\u5b8c\u6574\u5b89\u88c5\u6559\u7a0b <\/p>\n<p>\u521b\u4f5c\u58f0\u660e\uff1a\u672c\u6587\u90e8\u5206\u5185\u5bb9\u7531AI\u8f85\u52a9\u751f\u6210\uff08AIGC\uff09\uff0c\u4ec5\u4f9b\u53c2\u8003<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u793a\u4f8b\u5de5\u7a0b \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u301130dayMakeCppServer 30\u5929\u81ea\u5236C\u670d\u52a1\u5668&#xff0c;\u5305\u542b\u6559\u7a0b\u548c\u6e90\u4ee3\u7801 \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/GitHub_Trending\/30\/30dayMakeCppServer \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d  \u5728\u524d\u9762\u7684\u6559\u7a0b\u4e2d&#xff0c;\u6211\u4eec\u5df2\u7ecf\u5b8c\u6210\u4e86\u4e3b\u4ece Reactor \u591a\u7ebf\u7a0b\u670d\u52a1\u5668\u6838\u5fc3\u67b6\u6784\u7684\u5f00\u53d1\u3002\u4ece\u8fd9\u4e00\u5929\u5f00\u59cb&#xff0c;\u5f00\u53d1\u91cd\u5fc3\u4ece\\&#8221;\u642d\u5efa\u67b6\u6784\\&#8221;\u8f6c\u5411\\&#8221;\u6253\u78e8\u7ec6\u8282\\&#8221;&#xff1a;\u7528 CMake \u53d6\u4ee3\u624b\u5199<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-115173","post","type-post","status-publish","format-standard","hentry","category-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>30\u5929\u81ea\u5236C++\u670d\u52a1\u5668\uff08day13\uff09\uff1a\u7528CMake\u3001clang-format\u3001cpplint\u4e0eclang-tidy\u5b8c\u6210\u9879\u76ee\u5de5\u7a0b\u5316\u4e0e\u4ee3\u7801\u8d28\u91cf\u7ba1\u63a7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/115173.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"30\u5929\u81ea\u5236C++\u670d\u52a1\u5668\uff08day13\uff09\uff1a\u7528CMake\u3001clang-format\u3001cpplint\u4e0eclang-tidy\u5b8c\u6210\u9879\u76ee\u5de5\u7a0b\u5316\u4e0e\u4ee3\u7801\u8d28\u91cf\u7ba1\u63a7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u793a\u4f8b\u5de5\u7a0b \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u301130dayMakeCppServer 30\u5929\u81ea\u5236C\u670d\u52a1\u5668&#xff0c;\u5305\u542b\u6559\u7a0b\u548c\u6e90\u4ee3\u7801 \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/GitHub_Trending\/30\/30dayMakeCppServer \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d \u5728\u524d\u9762\u7684\u6559\u7a0b\u4e2d&#xff0c;\u6211\u4eec\u5df2\u7ecf\u5b8c\u6210\u4e86\u4e3b\u4ece Reactor \u591a\u7ebf\u7a0b\u670d\u52a1\u5668\u6838\u5fc3\u67b6\u6784\u7684\u5f00\u53d1\u3002\u4ece\u8fd9\u4e00\u5929\u5f00\u59cb&#xff0c;\u5f00\u53d1\u91cd\u5fc3\u4ece&quot;\u642d\u5efa\u67b6\u6784&quot;\u8f6c\u5411&quot;\u6253\u78e8\u7ec6\u8282&quot;&#xff1a;\u7528 CMake \u53d6\u4ee3\u624b\u5199\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/115173.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-11T04:08:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011040857-6acb0bd9dcc29.svg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115173.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/115173.html\",\"name\":\"30\u5929\u81ea\u5236C++\u670d\u52a1\u5668\uff08day13\uff09\uff1a\u7528CMake\u3001clang-format\u3001cpplint\u4e0eclang-tidy\u5b8c\u6210\u9879\u76ee\u5de5\u7a0b\u5316\u4e0e\u4ee3\u7801\u8d28\u91cf\u7ba1\u63a7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-11T04:08:59+00:00\",\"dateModified\":\"2026-10-11T04:08:59+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/115173.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/115173.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115173.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"30\u5929\u81ea\u5236C++\u670d\u52a1\u5668\uff08day13\uff09\uff1a\u7528CMake\u3001clang-format\u3001cpplint\u4e0eclang-tidy\u5b8c\u6210\u9879\u76ee\u5de5\u7a0b\u5316\u4e0e\u4ee3\u7801\u8d28\u91cf\u7ba1\u63a7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"30\u5929\u81ea\u5236C++\u670d\u52a1\u5668\uff08day13\uff09\uff1a\u7528CMake\u3001clang-format\u3001cpplint\u4e0eclang-tidy\u5b8c\u6210\u9879\u76ee\u5de5\u7a0b\u5316\u4e0e\u4ee3\u7801\u8d28\u91cf\u7ba1\u63a7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/115173.html","og_locale":"zh_CN","og_type":"article","og_title":"30\u5929\u81ea\u5236C++\u670d\u52a1\u5668\uff08day13\uff09\uff1a\u7528CMake\u3001clang-format\u3001cpplint\u4e0eclang-tidy\u5b8c\u6210\u9879\u76ee\u5de5\u7a0b\u5316\u4e0e\u4ee3\u7801\u8d28\u91cf\u7ba1\u63a7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u793a\u4f8b\u5de5\u7a0b \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u301130dayMakeCppServer 30\u5929\u81ea\u5236C\u670d\u52a1\u5668&#xff0c;\u5305\u542b\u6559\u7a0b\u548c\u6e90\u4ee3\u7801 \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/GitHub_Trending\/30\/30dayMakeCppServer \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d \u5728\u524d\u9762\u7684\u6559\u7a0b\u4e2d&#xff0c;\u6211\u4eec\u5df2\u7ecf\u5b8c\u6210\u4e86\u4e3b\u4ece Reactor \u591a\u7ebf\u7a0b\u670d\u52a1\u5668\u6838\u5fc3\u67b6\u6784\u7684\u5f00\u53d1\u3002\u4ece\u8fd9\u4e00\u5929\u5f00\u59cb&#xff0c;\u5f00\u53d1\u91cd\u5fc3\u4ece\"\u642d\u5efa\u67b6\u6784\"\u8f6c\u5411\"\u6253\u78e8\u7ec6\u8282\"&#xff1a;\u7528 CMake \u53d6\u4ee3\u624b\u5199","og_url":"https:\/\/www.wsisp.com\/helps\/115173.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-11T04:08:59+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011040857-6acb0bd9dcc29.svg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/115173.html","url":"https:\/\/www.wsisp.com\/helps\/115173.html","name":"30\u5929\u81ea\u5236C++\u670d\u52a1\u5668\uff08day13\uff09\uff1a\u7528CMake\u3001clang-format\u3001cpplint\u4e0eclang-tidy\u5b8c\u6210\u9879\u76ee\u5de5\u7a0b\u5316\u4e0e\u4ee3\u7801\u8d28\u91cf\u7ba1\u63a7 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-11T04:08:59+00:00","dateModified":"2026-10-11T04:08:59+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/115173.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/115173.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/115173.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"30\u5929\u81ea\u5236C++\u670d\u52a1\u5668\uff08day13\uff09\uff1a\u7528CMake\u3001clang-format\u3001cpplint\u4e0eclang-tidy\u5b8c\u6210\u9879\u76ee\u5de5\u7a0b\u5316\u4e0e\u4ee3\u7801\u8d28\u91cf\u7ba1\u63a7"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=115173"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115173\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=115173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=115173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=115173"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=115173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}