Coder Social home page Coder Social logo

geek_time_cpp's Introduction

现代 C++ 实战 30 讲示例代码

这里存放的是现代 C++ 实战 30 讲的示例代码。构建代码需要 CMake 和下列编译器之一:

  • MSVC(Visual Studio)2019 16.4.4 或更新版本
  • GCC 7 或更新版本
  • Clang 7 或更新版本

我假设 Windows 用户使用 MSVC 和 vcpkg,Linux 用户使用 GCC 和发布版的包管理器,macOS 用户使用 Clang 和 Homebrew。其他组合我不测试,也不知道是否可用。

基本构建过程:

git clone https://github.com/adah1972/geek_time_cpp.git
cd geek_time_cpp
git submodule init
git submodule update
mkdir build
cd build
cmake ..
cmake --build . -j

最后四步(从 mkdir buildcmake --build …)也可以进入到子目录下进行,只构建那一部分的代码。

在使用 MSVC 时,可以在最后一步时指定构建的类型:Debug、Release、MinSizeRel 或 RelWithDebInfo。比如,下面的命令可指定构建 Release 版本(缺省为 Debug):

cmake --build . -j --config Release

在使用 GCC 和 Clang(Unix Makefiles)时,只能在创建工程文件时指定构建类型(缺省跟一般的命令行一样,非调试、非优化)。比如,下面的命令可指定构建 Debug 版本(我们在 21 讲和 26 讲有例子需要调试符号):

cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build . -j

geek_time_cpp's People

Contributors

adah1972 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.