# cplus-hello **Repository Path**: joshua_liu/cplus-hello ## Basic Information - **Project Name**: cplus-hello - **Description**: c++学习、练习,包含cmake - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-08-29 - **Last Updated**: 2025-08-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 1.编译cpp文件 ```shell g++ -c example/example.cpp -o build/Debug/example.o g++ -c main.cpp -o build/Debug/main.o ``` 2.链接 ```shell g++ build/Debug/main.o build/Debug/example.o -o program ``` 3.执行(windows下gitbash不能正常执行,必须使用cmd执行) ```powershell .\program.exe # 全局集成后,所有 Visual Studio 项目自动识别 vcpkg 安装的库 vcpkg integrate install ``` 在Windows上,静态库通常以 `.lib` 文件的形式存在;在Linux和MacOS上,静态库通常以 `.a` 文件的形式存在。 在Windows上,动态库通常以 `.dll` 文件的形式存在;在Linux和MacOS上,动态库通常以 `.so` 文件的形式存在。 也可以在项目属性页中添加库文件,它与在代码中添加#pragma comment(lib, "FactoryMethodMode.lib")是一样的效果 cmake .. -B build -DCMAKE_TOOLCHAIN_FILE=/f/vcpkg/scripts/buildsystems/vcpkg.cmake