How do I get started writing C++ projects? I have experience with JavaScript, Go, Rust, Ruby, etc. so what are the package managers, build tools, and libraries?
我如何开始编写C ++项目? 我有JavaScript,Go,Rust,Ruby等的经验,那么包管理器,构建工具和库是什么?
C++ is a systems level programming language designed as an extension to C, introducing classes, generics, object initializers, destructors and by extension Resource Allocation is Initialization (RAII), and much more. The language was designed by Dr. Bjorne Strustrup (@stroustrup) in 1985 at Bell Labs in Holmdel, New Jersey.
C ++是一种系统级编程语言,被设计为C的扩展 ,引入了类,泛型,对象初始化器,析构函数,并由此扩展了资源分配即初始化 (RAII)等功能。 该语言由Bjorne Strustrup博士( @stroustrup )于1985年在新泽西州霍姆德尔市的贝尔实验室设计 。
Source: A New Urbanist Developer Gives Saarinen a Reboot by Bloomberg
来源:一位新的都市主义者开发商让Saarinen重启 彭博社
Since then it’s been the de-facto language for high performance computing, games, film rendering, simulations, scientific computing, the underlying language for machine learning libraries, native applications for Windows, MacOS/iOS (with Objective C++), Linux, game consoles, web browsers, databases, and so much more.
从那时起,它一直是用于高性能计算,游戏,电影渲染,模拟,科学计算,机器学习库的基础语言,Windows,MacOS / iOS(带有Objective C ++)的本地应用程序,Linux,游戏机的实际语言。 ,网络浏览器,数据库等等。
With so much support across the industry, it’s a shame the C++ ecosystem is much more difficult to work with than other languages such as Rust, JavaScript, Python, Go, etc.
有了整个行业的大力支持 ,与其他语言(例如Rust,JavaScript,Python,Go等)相比,使用C ++生态系统更加困难,真是可惜。
There’s a variety of different IDEs, each with their own project files such as:
有各种不同的IDE,每个IDE都有自己的项目文件,例如:
.sln
.sln
.xcworkspace
.xcworkspace
makefile
, though this is more of a build script.makefile
, 尽管这更多是一个构建脚本。
There’s a variety of build systems that can abstract IDEs for multi-platform development such as:
各种各样的构建系统可以抽象化IDE以进行多平台开发,例如:
CMake
CMake的
Meson
介子
There’s no official package manager, rather there are a variety of different package managers and intermediary solutions. These include:
official没有官方的软件包管理器,而是有各种不同的软件包管理器和中介解决方案。 这些包括:
git
submodulesgit
子模块Microsoft’s vcpkg
微软的vcpkg
Conan
柯南
It’s also common for projects to use precompiled binaries for libraries (.lib
, .so
, or .a
) as well, since that saves them the trouble of recompiling, increasing build speeds at the cost of tying your project to the compiler version your library was built for.
项目也通常使用预编译的二进制库( .lib
, .so
或.a
),因为这免除了它们重新编译的麻烦,提高了构建速度,但以将项目与库的编译器版本绑定为代价专为。
There’s no official compiler, there’s a variety of compilers that operating system developers maintain, such as:
official没有官方的编译器,操作系统开发人员维护的编译器很多,例如:
LLVM Clang
LLVM lang声
Microsoft Visual C++ Compiler (MSVC)
Microsoft Visual C ++编译器(MSVC)
The GNU Compiler Collection (gcc)
GNU编译器集合(gcc)
While the standard library is maintained heavily, it’s not uncommon for companies to maintain their own standard library alternatives to improve their application performance, or for unique features:
尽管标准库维护很重, 但公司维护自己的标准库替代品以提高其应用程序性能或独特功能的情况并不少见 :
Microsoft’s Standard Library for MSVC
Microsoft的MSVC标准库
Electronic Arts (EA)’s EASTL
电子艺术(EA)的EASTL
Boost’s family of libraries
Boost的图书馆家族
Facebook’s Folly
Facebook的愚蠢
#include class MyActor : Actor
{
virtual void update() override
{
std::vector strings;
strings.emplace_back(" CamelCase");
strings.push_back(" snake_case")
}
};
There is no standard for code, with some projects adopting camelCase
for functions and variables, some adopting snake_case
like the standard library, and some adopting prefixes for classes like Actors (♟️ AMyPawn
) such as Unreal Engine. That being said there are linters and tools to enforce standards in formatting in your code such as:
存在用于代码没有标准,一些项目采用 camelCase
为函数和变量,一些采用 snake_case
像标准库,和一些采用前缀等演员(♟️类AMyPawn
)如虚幻引擎 。 话虽这么说,但还是有一些linter和工具可以在您的代码中强制执行格式设置标准,例如:
clang tidy
lang整洁
clang format
lang格式
While these might appear as weaknesses at first glance, the fact that there’s so many alternatives to all of these different classes of problems attests to how large and capable the C++ community is. That being said the fact that there’s no one opinion to each of these problems means that it’s hard for folks starting to learn C++ to know what to do. This post will serve as a guide and introduction to greenfield C++ for those migrating from other languages that feature more opinionated workflows such as JavaScript, Rust, etc.
乍一看,这些可能看起来是弱点,但所有这些不同类别的问题都有如此众多的选择,这一事实证明了C ++社区的规模和能力。 话虽这么说,但对每个问题都没有意见,这意味着开始学习C ++的人们很难知道该怎么做。 这篇文章将作为Greenfield C ++的指南和入门指南,供那些从其他语言迁移而来的人使用,这些语言具有更加自觉的工作流程,例如JavaScript,Rust等。
CMake的 (CMake)
CMake is the most common C++ Library/Application build tool, and makes writing applications and using dependencies much easier than managing them via IDE specific methods.
CMake是最常见的C ++库/应用程序构建工具,它使编写应用程序和使用依赖项比通过IDE特定方法进行管理要容易得多。
The following is a basic CMake CMakeLists.txt
file you would put at the top directory of your library/application:
以下是基本的CMake CMakeLists.txt
文件,您可以将其放在库/应用程序的顶级目录中:
# Project Infocmake_minimum_required(VERSION 3.6 FATAL_ERROR)
cmake_policy(VERSION 3.6)
project(MyApplication
VERSION 1.0.0.0
LANGUAGES C CXX
)# =============================================================# Common CMake Settings# Use Folders in Project Files
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Don't generate useless CMake Build Scripts
set(CMAKE_SUPPRESS_REGENERATION true)
# Use C++ 14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)# Write all libraries/executables to `/bin/`
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)# Add a `d` postfix to denote debug libraries/executables
if(NOT CMAKE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX d)
endif()# =============================================================# Sources
file(GLOB_RECURSE FILE_SOURCES RELATIVE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/*.h
)# Solution Filters
foreach(source IN LISTS FILE_SOURCES)
get_filename_component(source_path "${source}" PATH)
string(REPLACE "/" "\\" source_path_msvc "${source_path}")
string(REPLACE "src" "" source_path_final "${source_path_msvc}")
source_group("${source_path_final}" FILES "${source}")
endforeach()# =============================================================# Finalize Appadd_executable(
${PROJECT_NAME}
"${FILE_SOURCES}"
)# =============================================================# Dependencies# For example, you could import a git submodule like so:
# add_subdirectory(external/yourdependency)
# set_property(TARGET LibraryName PROPERTY FOLDER "Dependencies")
# target_link_libraries(${PROJECT_NAME} LibraryName)# =============================================================# Finish Settings# Write this project's libraries/executables to `/bin/`
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
# Change working directory to top dir to access `assets` folder
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/..)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
endif()
安装依赖项 (Installing Dependencies)
There’s multiple ways to add dependencies, the one I would recommend the most is using git submodule
s. Since dependencies are built from source, there's less headaches involved when linking and building your final application.
添加依赖项有多种方法,我最推荐的一种方法是使用git submodule
。 由于依赖关系是从源代码构建的,因此在链接和构建最终应用程序时所涉及的麻烦就更少了。
# At your project root folder
mkdir external
cd external
git submodule add https://github.com/alaingalvan/crosswindow.git
And inside your CMakeLists.txt
file:
在您的CMakeLists.txt
文件中:
# ✖ CrossWindow
add_subdirectory(external/crosswindow)
set_property(TARGET CrossWindow PROPERTY FOLDER "Dependencies")
Some projects distribute CMake build scripts that you can use to link dependencies to your project:
一些项目分发了CMake构建脚本,可用于将依赖项链接到项目:
# Packages (installed by frameworks like Qt)
find_package(Qt5 COMPONENTS Core Gui REQUIRED)
And libraries accessible in system folders can also be found by CMake, such as Apple Frameworks:
CMake也可以找到系统文件夹中可访问的库,例如Apple Frameworks:
# Libraries (such as Apple Frameworks like Cocoa, Metal, UIKit, etc.)
find_library(METAL_LIBRARY Metal)
You can also add libraries manually by just including the source files like so:
您还可以通过仅添加源文件来手动添加库,如下所示:
# Cpp and Headers
add_library(Glad external/glad/src/glad.c)
target_include_directories(Glad PRIVATE external/glad/include)
include_directories(external/glad/include)
Or if a project is header only, you could just include that directory, just be sure to call this after you’ve created your binary project with cmake function add_executable
, refer to the example script above if anything.
或者,如果项目仅是标题,则可以只包含该目录,请确保在使用cmake函数add_executable
创建二进制项目后确保调用此目录,如果有的话,请参考上面的示例脚本。
# Header Only
target_include_directories(${PROJECT_NAME} external/json/include)
From there you can link that dependency to your project like so:
从那里,您可以将这种依赖关系链接到项目,如下所示:
target_link_libraries(${PROJECT_NAME} LibraryName)
add_dependencies(${PROJECT_NAME} LibraryName)
建造 (Building)
To build a project you’ve downloaded with the terminal, similar to npm start
for Node.js, cargo run
for Rust, etc. you can do the following:
要构建通过终端下载的项目,类似于Node.js的npm start
,Rust的cargo run
等,您可以执行以下操作:
# Make a build folder
mkdir build
cd build# ️ To build your Visual Studio solution on Windows x64
cmake .. -A x64# To build your XCode project On Mac OS for Mac OS
cmake .. -G Xcode# To build your XCode project on Mac OS for iOS / iPad OS / tvOS / watchOS
cmake .. -G Xcode -DCMAKE_SYSTEM_NAME=iOS# To build your .make file on Linux
cmake ..# For WebAssembly Projects
cmake .. -DCMAKE_TOOLCHAIN_FILE="$EMSDK/emscripten//cmake/Modules/Platform/Emscripten.cmake"# For Android write a build.gradle file# Build on any platform:
cmake --build .
With WebAssembly Projects, you’ll need to use emmake
, Emscripten's alternative to the GNU Make.
对于WebAssembly项目,您将需要使用emmake
, Emscripten的替代品是GNU Make。
# ⚙️ Run emconfigure with the normal configure command as an argument.
$EMSDK/emscripten/emconfigure ./configure# Run emmake with the normal make to generate linked LLVM bitcode.
$EMSDK/emscripten/emmake make# Compile the linked bitcode generated by make (project.bc) to JavaScript.
# 'project.bc' should be replaced with the make output for your project (e.g. 'yourproject.so')
$EMSDK/emscripten/emcc project.bc -o project.js
For more information visit the Emscripten Docs on CMake.
有关更多信息,请访问CMake上的Emscripten文档 。
For Android Studio you’ll need to make a project, then edit your build.gradle
file.
对于Android Studio,您需要创建一个项目,然后编辑build.gradle
文件。
// To build your Android Studio project
android {
...
externalNativeBuild {
cmake {
...
// Use the following syntax when passing arguments to variables:
// arguments "-DVAR_NAME=ARGUMENT".
arguments "",
// The following line passes 'rtti' and 'exceptions' to 'ANDROID_CPP_FEATURES'.
"-DANDROID_CPP_FEATURES=rtti exceptions"
}
}
buildTypes {...} // Use this block to link Gradle to your CMake build script.
externalNativeBuild {
cmake {...}
}
}
for more information visit Android Studio’s docs on CMake.
有关更多信息,请访问CMake上的Android Studio文档 。
代码清理 (Code Cleanup)
Having a .clang-format
file in your top level directory allows for text editors and IDEs to use that file to format your code.
顶级目录中包含.clang-format
文件,文本编辑器和IDE可以使用该文件来格式化代码。
# Run manually to reformat a file:
# clang-format -i --style=file
BasedOnStyle: llvm
DerivePointerAlignment: false
UseTab: Never
AllowShortIfStatementsOnASingleLine: true
IndentWidth: 4
TabWidth: 4
BreakBeforeBraces: Allman
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
Cpp11BracedListStyle: true
IndentWrappedFunctionNames: true
PointerAlignment: Left
FixNamespaceComments: false
Also, having a .clang-tidy
file can help with maintaining your project's code styles and find odd errors:
另外,拥有一个.clang-tidy
文件可以帮助您维护项目的代码风格并发现奇怪的错误:
Checks: >
-*,
readability-*,
-readability-uppercase-literal-suffix,
-readability-magic-numbers,
-readability-isolate-declaration,
-readability-convert-member-functions-to-static,
-readability-implicit-bool-conversion,
-readability-avoid-const-params-in-decls,
-readability-simplify-boolean-expr,
-readability-make-member-function-const, -readability-misleading-indentation, -readability-inconsistent-declaration-parameter-name,
-readability-redundant-preprocessor,
-readability-redundant-member-init,
-readability-const-return-type,
-readability-static-accessed-through-instance,
-readability-redundant-declaration,
-readability-qualified-auto,
-readability-use-anyofallof, bugprone-*,
-bugprone-narrowing-conversions,
-bugprone-unhandled-self-assignment,
-bugprone-branch-clone,
-bugprone-macro-parentheses,
-bugprone-reserved-identifier, -bugprone-sizeof-expression,
-bugprone-integer-division,
-bugprone-incorrect-roundings,
-bugprone-copy-constructor-init,WarningsAsErrors: '*'
测试中 (Testing)
For the sake of making it easier for individuals to consume my libraries via git submodule
s, I keep all tests on a separate branch, and require that you specify if you want tests enabled. This means build specific dependencies like Google Test
only need to exist as submodules if the user switches to that branch, if they're consuming the library they won't ever switch to that branch saving them installation and build time.
为了使个人更容易通过git submodule
使用我的库,我将所有测试保留在单独的分支上,并要求您指定是否要启用测试 。 这意味着仅当用户切换到该分支时 ,特定于构建的依赖项(如Google Test
才需要作为子模块存在;如果用户正在使用该库,则永远不会切换到该分支,从而节省了安装和构建时间。
option(MYLIB_TESTS "If enabled, compile the tests." OFF)if (MYLIB_TESTS)
MESSAGE( STATUS "Building My Library Tests..." ) set_property(GLOBAL PROPERTY USE_FOLDERS ON) # we use this to get code coverage
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
endif() # Unit Tests
set(GOOGLETEST_ROOT external/googletest/googletest CACHE STRING "Google Test source root")
include_directories(
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/include
${PROJECT_SOURCE_DIR}/src
) set(GOOGLETEST_SOURCES
${PROJECT_SOURCE_DIR}/${GOOGLETEST_ROOT}/src/gtest-all.cc
) foreach(_source ${GOOGLETEST_SOURCES})
set_source_files_properties(${_source} PROPERTIES GENERATED 1)
endforeach() add_library(GoogleTest ${GOOGLETEST_SOURCES}) file(GLOB_RECURSE tests_list RELATIVE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tests/*.mm
${CMAKE_CURRENT_SOURCE_DIR}/tests/*.h
${CMAKE_CURRENT_SOURCE_DIR}/tests/*.hpp
) # Solution Filters
foreach(test IN LISTS tests_list)
get_filename_component(test_path "${test}" PATH)
string(REPLACE "/" "\\" test_path_msvc "${test_path}")
string(REPLACE "tests" "" test_path_final "${test_path_msvc}")
source_group("${test_path_final}" FILES "${test}")
endforeach() add_executable(
Tests
"${tests_list}"
) if(NOT MSVC)
find_package(Threads REQUIRED)
set(PThreadLib -pthread)
endif() target_link_libraries(
Tests
${PROJECT_NAME}
${PThreadLib}
GoogleTest
)
add_dependencies(
Tests
${PROJECT_NAME}
GoogleTest
)
include(CTest)
enable_testing()
add_test(
NAME UnitTests
COMMAND Tests
) set_property(TARGET GoogleTest PROPERTY FOLDER "Dependencies")endif()
Here’s an example of writing a test in Google Test, though for your applications you’ll want to test out interfaces and tasks the library needs to do, such as parsing and compiling code, creating data structures, etc.
这是在Google Test中编写测试的示例,尽管对于您的应用程序,您将需要测试库需要执行的接口和任务,例如解析和编译代码,创建数据结构等。
#include "gtest/gtest.h"TEST(TestCategory, TestName)
{
int x = 0;
EXPECT_TRUE(x == x);
}
Travis CI is a great option for testing changes in your code at build time when pushed to your Git server:
Travis CI是在推送到Git服务器时在构建时测试代码更改的绝佳选择:
sudo: false
env:
global:
- CXX_FLAGS="-Wall -pedantic -Werror -Wno-variadic-macros -Wno-long-long -Wno-shadow"
language:
- cpp
compiler:
- g++
addons:
apt:
update: true
sources:
- ubuntu-toolchain-r-test
packages:
- lcov
- cmake
- cmake-data
before_install:
- export CXX_FLAGS=${CXX_FLAGS}" "${ENV_CXX_FLAGS}
script:
- git submodule update --init --recursive
- mkdir make
- cd make
- cmake .. -DMYAPP_TESTS=ON
- cmake --build .
- ctest . --verboseafter_success:
- lcov --directory . --capture --output-file coverage.info
- lcov --remove coverage.info '/usr/*' --output-file coverage.info
- lcov --list coverage.info
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"notifications:
email: false
If you’re writing an application for Windows, you’ll need to use a continuous intergration tool like AppVeyor:
如果要为Windows编写应用程序,则需要使用AppVeyor之类的连续集成工具:
# Windows Build Configuration for AppVeyor
# http://www.appveyor.com/docs/appveyor-yml# build version format
version: "{build}"os: Visual Studio 2017platform:
- x64configuration:
- Releasebranches:
only:
- masterbuild:
parallel: true
verbosity: minimalbuild_script:
- git checkout tests
- git submodule update --init --recursive
- mkdir visualstudio && cd visualstudio
- cmake .. -DMYAPP_TESTS=ON
- cmake --build .
- ctest . -C Debug --verbosetest_script:notifications:
- provider: Email
to:
- '{{commitAuthorEmail}}'
on_build_success: false
on_build_failure: false
on_build_status_changed: false
With Circle CI being useful for MacOS and Android Testing, though there is an cost to it:
Circle CI对于MacOS和Android测试很有用,尽管这样做有一定的成本:
machine:
environment:
ANDROID_NDK: $HOME/android-ndk-r12b
ANDROID_NDK_HOME: $ANDROID_NDK
PATH: $PATH:$ANDROID_NDKgeneral:dependencies:
cache_directories:
- ~/android-ndk-r12b
pre:
- git checkout tests
- git submodule update --init --recursive
#-- Install NDK r12b --
- if [[ ! -e ~/android-ndk-r12b ]]; then wget http://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip && unzip -d ~ android-ndk-r12b-linux-x86_64.zip; fi
#-- Intall Android SDK Build-tools, revision 24.0.0 --
- echo y | android update sdk --no-ui --all --filter "build-tools-24.0.0"
#---Install CMake--
- wget https://github.com/Commit451/android-cmake-installer/releases/download/1.1.0/install-cmake.sh
- chmod +x install-cmake.sh
- ./install-cmake.sh
#------------------
- echo "ndk.dir=/home/ubuntu/android-ndk-r12b" > local.properties
- chmod +x gradlew
-test:
override:
- ./gradlew assembleDebug
结论 (Conclusion)
C++ is an incredibly useful language for highly performant applications such as games with Unreal Engine 4 or your own custom engine, geometric processing, physical simulations, and native application development across operating systems. These are the most common use cases, but it’s also possible to develop web servers as most backend databases use C++, just about anything can be written in it.
对于高性能应用程序(例如,使用虚幻引擎4或您自己的自定义引擎进行的游戏,几何处理,物理模拟以及跨操作系统的本机应用程序开发),C ++是一种非常有用的语言。 这些是最常见的用例,但是也可以开发Web服务器,因为大多数后端数据库都使用C ++,几乎任何内容都可以用C ++编写。
更多资源 (More Resources)
It can be helpful to look at existing projects as a guide to designing your own greenfield applications. I also have a large list of amazing C++ projects on my GitHub stars, so take a look, here are some ✨ highlights:
将现有项目作为设计自己的全新应用程序的指南可能会有所帮助。 在GitHub上 ,我还有很多很棒的C ++项目,因此,看一下✨的一些亮点:
Blender 3D repo’s shows their build philosophy and linting tools such as
clang-tidy
,clang-format
.Blender 3D repo展示了其构建原理和
clang-tidy
工具,例如clang-tidy
,clang-format
。ImGUI is arguably the best UI library for C++.
ImGUI可以说是C ++最好的UI库。
NVIDIA Falcor powers a ton of examples related to computer graphics in C++, including the NVIDIA Introductory Course on Ray Tracing.
NVIDIA Falcor提供了许多与C ++计算机图形相关的示例,包括NVIDIA Ray Tracing入门课程 。
Google Filament by (@omainguy) is a full rendering engine and amazing reference.
( @omainguy )的Google Filament是一个完整的渲染引擎和令人惊叹的参考。
Epic Games’s Unreal Engine, though this requires that you register on Epic Games and tie your GitHub account to it.
Epic Games的Unreal Engine ,尽管这要求您在Epic Games上注册并将GitHub帐户绑定到它。
Boost’s Beast is an HTTP server library written in C++.
Boost's Beast是一个用C ++编写的HTTP服务器库。
Json by Niels Lohmann (@nlohmann) is effective JSON that can handle even massive files.
Niels Lohmann (@nlohmann)的 Json是有效的JSON,甚至可以处理大量文件。
Cereal by Shane Grant (@WShaneGrant) is one of my favorite serialization libraries.
Shane Grant( @WShaneGrant )的Cereal是我最喜欢的序列化库之一。
ChaiScript by Jason Turner (@lefticus) of Cppcast an embeded scripting language that’s easy to include in your projects.
Cppcast的Jason Turner的ChaiScript ( @lefticus )是一种易于在您的项目中包含的嵌入式脚本语言。
Sol2 by JeanHeyd Meneide (@thephantomderp) is a Lua library for parsing and executing Lua code bound to C++.
JeanHeyd Meneide的Sol2( @thephantomderp )是一个Lua库,用于解析和执行绑定到C ++的Lua代码。
RenderDoc by Baldur Karlsson (@baldurk) is one of the best debugging tools for computer graphics applications, and features a great Travis configuration that checks for formatting with pull requests.
RenderDoc由博德之门卡尔森( @baldurk )是最好的调试工具,计算机图形应用之一,并设有极佳的特拉维斯配置是检查与拉请求格式 。
There’s a few other resources on C++ best practices here:
这里还有一些其他有关C ++最佳实践的资源:
CppCon, CppNow and Cpp On Sea are research conferences focused on C++.
CppCon , CppNow和Cpp On Sea是针对C ++的研究会议。
CppCast is a frequently updated podcast discussing C++ standards and uses.
CppCast是一个经常更新的播客,讨论C ++标准和用法。
Include C++ is the most popular C++ discord server out there, but plenty of domain specific servers like the Vulkan, DirectX, ShaderToy discord have C++ discussions.
Include C ++是目前最流行的C ++ discord服务器,但是Vulkan , DirectX , ShaderToy discord等许多特定于域的服务器都有C ++讨论。
And for resources specific to CMake:
对于特定于CMake的资源:
Matt Keeter (@impraxical) wrote a post on compile time strings in CMake, useful for build related messages.
Matt Keeter ( @impraxical ) 在CMake上发表了一篇关于编译时间字符串的文章,对构建相关消息很有用。
Pablo Arias (@pabloariasal) wrote It’s Time To Do CMake Right, which offers more opinonated CMake design.
Pablo Arias ( @pabloariasal )写道, 现在是时候做CMake Right了 ,它提供了更多的透明化CMake设计。
Also, the journey to learning any programming language can be daunting to do alone, so I would encourage you to reach out to mentors on Twitter, send DMs and emails, talk on Discord/Slack/Twitter/Meetups, and don’t be afraid to communicate your goals and ideas!
另外,学习任何编程语言的旅程也可能很艰巨,所以我鼓励您在Twitter上与导师联系,发送DM和电子邮件,在Discord / Slack / Twitter / Meetups上进行交流,不要害怕传达您的目标和想法!
翻译自: https://medium.com/@AlainGalvan/migrating-to-c-from-other-languages-4bbcb1fc8b5f