{"id":20766146,"url":"https://github.com/navono/cpp-demo","last_synced_at":"2025-10-25T11:03:37.269Z","repository":{"id":74496119,"uuid":"378094569","full_name":"navono/cpp-demo","owner":"navono","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-22T08:59:35.000Z","size":23942,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"demo-new","last_synced_at":"2025-06-17T05:39:09.230Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/navono.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-18T09:07:12.000Z","updated_at":"2023-02-24T06:41:09.000Z","dependencies_parsed_at":"2024-11-17T23:30:19.659Z","dependency_job_id":null,"html_url":"https://github.com/navono/cpp-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"navono/cpp-project-template","purl":"pkg:github/navono/cpp-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navono%2Fcpp-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navono%2Fcpp-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navono%2Fcpp-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navono%2Fcpp-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/navono","download_url":"https://codeload.github.com/navono/cpp-demo/tar.gz/refs/heads/demo-new","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navono%2Fcpp-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280943396,"owners_count":26417747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T11:21:40.303Z","updated_at":"2025-10-25T11:03:37.252Z","avatar_url":"https://github.com/navono.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cpp Demo\n\n## 库\n\n使用 `CMake` 生成动态库，不会自动生成 `.lib` 文件，需要为工程创建导出头文件，也就是在 `CMakeLists.txt` 中增加\n\n\u003e set(PROJECT_EXPORT_HPP ${CMAKE_SOURCE_DIR}/include/${PROJECT_NAME}/export.hpp)\n\n然后在头文件中使用其生成的宏，例如：\n\n\u003e SHAREDLIB_EXPORT\n\n这样，才会在 CMake 的 build 目录下为其生成 `.lib` 文件。具体参考 `sharedLib 工程`。\n\n## 第三方库集成\n\n### Boost\n\n1. 下载源码\n2. bootstrap.bat 进行编译前准备\n3. 使用 b2 进行编译，也可指定要编译的库：--with filesystem regex\n\n   \u003e b2.exe --build-type=complete address-model=64 -j4 install --prefix=D:\\sourcecode\\cpp\\boost-install\n4. b2 tools/bcp 编译 bcp.exe， 可以进行指定模块提取，例如：\n   \u003e dist\\bin\\bcp filesystem regex E:\\myboost\n\n### CppCommon\n\n#### 编译\n\n需按照文档，下载 `gil` 后，再更新（管理员权限）\n\u003e gil update\n\n### 目标文件拷贝\n\n在 IDE 中进行编译，例如 `CLion`，架构选择 `amd64`，编译完成后，将 `cppcommon.lib` 拷贝到 `third_party/libs`\n目录下，将 `include` 拷贝到 `include/CppCommon` 目录下。\n\n### sqlite_orm\n\n在本地编译 `sqlite3` 后，将 `lib` 与 `sqlite3.h` 分别放到 `third_party/libs/·` 与 `include/sqlite3` 目录下。\n同时在 `third_party/CMakeLists.txt` 中指定变量。\n\n### matplot\n\n需预先在机器上安装 `gnuplot`。\n\n### ZeroMQ\n\n1. 下载源码，编译\n2. 在 `CMakeLists.txt` 中，如果是使用静态库，增加 `ZMQ_STATIC` 宏， 增加静态库 `libzmq`，同时 `Windows` 平台还需要增加 `\n   iphlpapi.lib`\n\n### find_package 无法查找到库 XXX\n\n1. `github` 上查找此库的源码，同时确认相关的版本\n2. `git clone` 到本地后，使用 `CMake` 构建并安装\n\n   \u003e cmake -B_builds_debug -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=\"D:\\\\cmake_install\"\n   \u003e\n   \u003e cmake --build _builds_debug --config Debug --target install\n\n   注意上述的构建目录、构建类型、安装目录\n3. 在目标工具中，例如 `CLion` 增加环境变量；也可在系统中增加系统环境变量\n\n   \u003e CMAKE_INCLUDE_PATH=\"D:\\cmake_install\\include\"\n   \u003e\n   \u003e CMAKE_LIBRARY_PATH=\"D:\\cmake_install\\lib\"\n4. 有时二进制会依赖动态库，所以需要将 `D:\\cmake_install\\bin` 加入到系统环境变量中\n\n其他 `CMake` 选项还有：\n\n      CMAKE_SYSTEM_PREFIX_PATH\n\n## 编译问题\n\n1. warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失\n\n   \u003e 文件编码问题。将文件改为带签名的（BOM） `UTF-8` 编码格式即可。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavono%2Fcpp-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnavono%2Fcpp-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavono%2Fcpp-demo/lists"}