Skip to content

Modern CPlusPlus Guide; The Modern C++ to solve real-world problems; CMake构建复杂工程项目、C/C++学习例子、OpenCV for CPP,数字图像处理DIP,深度学习CUDA加速,GPU编程,OpenGL and QT。Linux Shell 常用命令,Ubuntu and Manjaro。

2694048168/C-and-C-plus-plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPlusPlus Logo

C/C++ language learning and some examples; OpenCV with C++; CMake with C++; CUDA with C++; OpenGL with C++; Vulkan with Modern C++; the Modern C++ guide and features and Multi Threading in Modern C++; the QT and GUI with C++; the useful external C++ library.

Wei Li Blog

features

  • 现代 C++ 课程快速入门实战(CppModernCourse)
    • C++ 语言对比 C 语言的优势
      • constexpr 关键字指示编译器在编译时期对表达式求值
      • overload 函数重载(本质函数签名唯一), 代码复用
      • C++的引用(reference)是指针(pointer)处理的改进, 安全特性更强
      • 命名空间与结构体、联合体和枚举的隐式类型定义(typedef)
      • C and C++ 对象文件的混用, 链接阶段的调用约定和符号导出
      • for-range 简洁地表达想法和重用代码
      • C++ 标准库(STL)包含了高性能的泛型代码, 容器、迭代器和算法
      • lambda 函数, 提高代码的局部性
      • 模板(template)的泛型(generic)编程, 是指写一次代码就能适用于不同的类型
      • C++ 资源获取即初始化(RAII)技术管理对象生命周期
      • 所有权模型来管理动态对象的生命周期: 智能指针和移动语义
  • Serialization and Deserialization via Json for C++
  • Modern CMake and C++ Project Template
    • Modern CMake 构建复杂大型项目的基本设计
      • src 源代码文件夹
      • bin 可执行文件文件夹
      • lib 库管理文件夹
      • external 第三方库管理文件夹
      • test 测试管理文件夹
      • build 构建管理文件夹
    • Modern CMake 构建可执行程序文件
    • Modern CMake 构建静态库/动态库
  • External Cpp Library
  • Modern C++
  • Support CMake
  • Support GCC/Clang/MSVC
  • Support VSCode
  • Support CUDA
  • Support OpenGL
  • Support OpenCV
  • Support Vulkan
  • Support QT with OpenCV and OpenGL

overview

Quick Start

# step 1: clone the repo. and into the folder 'CppImageProcessing'
git clone --recursive https://github.com/2694048168/C-and-C-plus-plus.git

# 查看每一个文件夹下的 'README.md' 文件说明
# if you want to download specical folder, please using 'gitzip' tool to enter
# the folder path, such as 'https://github.com/2694048168/C-and-C-plus-plus/tree/master/CppImageProcessing'.
# [gitzip](http://kinolien.github.io/gitzip/)

Organization of Repo.

. C-and-C-plus-plus
|—— MultithreadingModernCpp
|   |—— README.md
|—— CMakeClangVcpkg
|   |—— vcpkg.json
|   |—— CMakePreset.json
|   |—— CMakeLists.txt
|   |—— .vscode
|   |—— |—— launch.json
|   |—— |—— tasks.json
|   |—— README.md
|—— CMakeTutorial
|   |—— ExeExample
|   |—— StaticLibExample
|   |—— DynamicLibExample
|   |—— NestCMakeExample
|   |—— GraphvizCMake
|   |—— README.md
|—— ModernGuideCpp17
|   |—— README.md
|—— ModernCppChallenge
|   |—— README.md
|—— CppSeries
|   |—— week01
|   |—— |—— CMakeLists.txt
|   |—— week02
|   |—— |—— CMakeLists.txt
|   |—— CMakeLists.txt
|   |—— README.md
|—— CppImageProcessing
|   |—— cuda_opencv
|   |—— images
|   |—— CMakeLists.txt
|   |—— vcpkg.json
|   |—— README.md
|—— CUDA_Programming
|   |—— 01_kernelFunction
|   |—— CMakeLists.txt
|   |—— README.md
|—— OpenGL_Cherno
|   |—— 00_opengl
|   |—— external
|   |—— |—— GLFW
|   |—— |—— GLEW
|   |—— rendering_pipeline.png
|   |—— CMakeLists.txt
|   |—— README.md
|—— OpenGL_Learning
|   |—— 00_hello_opengl
|   |—— resources
|   |—— thirdparty
|   |—— |—— GLFW
|   |—— |—— GLDA
|   |—— |—— GLM
|   |—— |—— STB
|   |—— CMakeLists.txt
|   |—— README.md
|—— CMakeReadme.md
|—— cmake_workflow.png
|—— Logo.png
|—— README.md

CUDA with C++

  • CUDA_CPlusPlus
  • CUDA_Programming
the CUDA Heterogeneous Programming with C++ via CMake.

the organization of project

. CUDA_Programming
|—— 01_kernelFunction
|   |—— main.cu
|   |—— CMakeLists.txt
|—— 05_CudaError
|   |—— include
|   |—— |—— add.cuh
|   |—— |—— cudaError.cuh
|   |—— src
|   |—— |—— add.cu
|   |—— |—— cudaError.cu
|   |—— CMakeLists.txt
|—— CMakeLists.txt
|—— README.md

OpenGL with C++

  • OpenGL_Cherno
  • OpenGL_Learning
Computer graphics is the art or science of producing graphical images with the aid of computer.

the basic development environment

# Modern code editor: Visual Studio Code
winget show code

# Build tool: CMake
cmake --version
# cmake version 3.26.3

# Compile tool: g++ from MinGW-64
g++ --version
gcc --version
mingw32-make --version
# g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 12.2.0
# gcc.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 12.2.0
# GNU Make 4.4 Built for x86_64-w64-mingw32

# GLFW: Windows pre-compiled binaries || 64-bit Windows binaries

# GLAD: Language(C/C++) || Specification(OpenGL) || Profile(Core) 
# || API-gl(Version 4.6) || others(None) ---> generate

the organization of project

. LearningOpenGL
|—— 00_hello_opengl
|   |—— src
|   |—— |—— hello_opengl.cpp
|   |—— CMakeLists.txt
|—— 01_hello_triangle
|   |—— src
|   |—— |—— hello_triangle.cpp
|   |—— CMakeLists.txt
|—— 02_rectangular
|—— 03_shader
|—— 03_shader
|—— 04_uniform
|—— 05_attribute
|—— 06_texture
|—— 07_transformations
|—— 08_coordinate
|—— 09_camera
|   |—— include
|   |—— |—— utils.hpp
|   |—— |—— shader.hpp
|   |—— shader
|   |—— |—— fragment.glsl
|   |—— |—— vertex.glsl
|   |—— src
|   |—— |—— camera_keyboard.cpp
|   |—— |—— camera_mouse_zoom.cpp
|   |—— |—— camera.cpp
|   |—— |—— shader.cpp
|   |—— |—— utils.cpp
|   |—— CMakeLists.txt
|—— thirdparty
|   |—— GLAD
|   |—— |—— include
|   |—— |—— src
|   |—— GLFW
|   |—— |—— include
|   |—— |—— lib
|   |—— STB
|   |—— |—— stb_image.h
|   |—— GLM
|   |—— |—— cmake
|   |—— |—— glm
|   |—— |—— |—— common.hpp
|—— bin
|—— lib
|—— build
|—— CMakeLists.txt
|—— images
|   |—— rendering_pileline.png
|—— README.md

some Useful linker

Basic Concepts

  • Graphics and Image
  • Computer Graphics & Digital Image Processing & Computer Vision
  • OpenGL identifier rule: <库前缀><根命令><可选参数数量><可选参数类型> "glColor3f"
  • OpenGL Graphics Pipeline: the process of transforming 3D coordinates to 2D pixels
  • Traditional rendering pipeline VS Volume rendering algorithm
  • Shader and OpenGL Shading Language(GLSL)
  • Primitive and Primitive Assembly
  • Normalized Device Coordinates,NDC

在OpenGL中, 任何事物都在3D空间中, 而屏幕和窗口却是2D像素数组, 这导致OpenGL的大部分工作都是关于把3D坐标转变为适应你屏幕的2D像素; 3D坐标转为2D坐标的处理过程是由OpenGL的图形渲染管线(Graphics Pipeline, 大多译为管线, 实际上指的是一堆原始图形数据途经一个输送管道, 期间经过各种变化处理最终出现在屏幕的过程)管理的; 图形渲染管线可以被划分为两个主要部分: 第一部分把你的3D坐标转换为2D坐标; 第二部分是把2D坐标转变为实际的有颜色的像素; 2D坐标和像素也是不同的, 2D坐标精确表示一个点在2D空间中的位置, 而2D像素是这个点的近似值, 2D像素受到你的屏幕/窗口分辨率的限制; 图形渲染管线可以被划分为几个阶段, 每个阶段将会把前一个阶段的输出作为输入; 所有这些阶段都是高度专门化的(它们都有一个特定的函数), 并且很容易并行执行, 正是由于它们具有并行执行的特性, 当今大多数显卡都有成千上万的小处理核心, 它们在GPU上为每一个渲染管线阶段运行各自的小程序, 从而在图形渲染管线中快速处理你的数据, 这些小程序叫做着色器(Shader). 有些着色器可以由开发者配置, 因为允许用自己写的着色器来代替默认的, 所以能够更细致地控制图形渲染管线中的特定部分了, 因为它们运行在GPU上, 所以节省了宝贵的CPU时间, OpenGL着色器是用OpenGL着色器语言(OpenGL Shading Language, GLSL)写成的.

Rendering Pipeline, 物体的顶点在最终转化为屏幕坐标之前还会被变换到多个坐标系统(Coordinate System); 将物体的坐标变换到几个过渡坐标系(Intermediate Coordinate System)的优点在于, 在这些特定的坐标系统中, 一些操作或运算更加方便和容易.

CMake with C++

  • CMakeClangVcpkg
the modern for C++ with the modern toolchains, include CMake, vcpkg, Ninja, Clang and Git in VSCode.
  • CMakeTutorial
the modern CMake tutorial for C++ build, examples about Executable Binary Programm, Static librarys and dynamic librarys, example about the Nest-style CMake and the graphviz releationship. We must to pay attention to the difference in loading dynamic libraries between Windows and Linux systems, that is, the symbol table import ways of dynamic libraries.
  • CMakeExamples
  • CMakeReadme.md

OpencCV with C++

  • CppImageProcessing
Image Processing Opertors and Algorithms with c++ via OpenCV libarary.

Quick Start

# step 1: clone the repo. and into the folder 'CppImageProcessing'
git clone --recursive https://github.com/2694048168/C-and-C-plus-plus.git
cd C-and-C-plus-plus/CppImageProcessing

# install C++ package manager 'vcpkg'
# step 2: modify the 'vspkg' install path in the top 'CMakeLists.txt' file.
set(CMAKE_TOOLCHAIN_FILE "[path to vcpkg]/scripts/buildsystems/vcpkg.cmake")

# it may be time consumming in the first time build,
# because of downloading and building the OpenCV library.
# CMake configuration and build(compiler and linker)
cmake -B build
cmake --build build

# enter into 'bin' and running the demo example, such as 'RandomText'
cd bin
./RandomText
./CudaOpenCV

Useful Links

Organization of Project

. CppImageProcessing
|—— hello_start
|   |—— main.cpp
|   |—— CMakeLists.txt
|—— build
|   |—— |—— vcpkg_installed
|   |—— |—— |—— x64-windows
|   |—— |—— |—— |—— bin
|   |—— |—— |—— |—— lib
|   |—— |—— |—— |—— include
|—— CMakeLists.txt
|—— vcpkg.json
|—— bin
|—— lib
|—— images
|—— README.md
  • OpenCV_Linux_Ubuntu
  • OpenCV-CPP

C/C++ Language Learning

  • ModernCppChallenge
  • C++PrimerPlus6thExercise
C++ Primer Plus 第6版中文版 编程练习答案
  • CppConcurrencyAction
现代 C++ 多线程编程和并发编程实战
  • MultithreadingModernCpp
the multi-threading in Modern C++, including the thread | mutex | lock | conditional variable | atomic operator, etc.
  • ModernGuideCpp17
the Modern C++ features and use examples for C++11, C++17 and C++23.
  • CppSeries
the modern C++ tutorial with CMake and Ninja build-tool and Clang++ compiler in VSCode from Shiqi Yu Prof. and the tutorial video on Bilibili

CPP tutorial with CMake and Clang++

the modern C++ tutorial with CMake and Ninja build-tool and Clang++ compiler in VSCode from Shiqi Yu Prof. and the tutorial video on Bilibili

Qucik Start

# git clone this repo. and enter the folder.
git clone --recursive https://github.com/2694048168/C-and-C-plus-plus.git
cd C-and-C-plus-plus/CppSeries

# cmake build(compile and link)
cmake -B build -G Ninja
cmake --build build

# or g++/clang++ for single source cpp file
g++ hello.cpp -std=c++17 -o main
clang++ hello.cpp -std=c++17 -o main

# in the 'CppSeries/week10/opencv_mat' folder,
# you should build(compile and link) individually with CMake,
# the more detail information seen in 'README.md' file in this folder.

Organization of Repo.

. Project_Name
|—— week01
|   |—— arithmetic
|   |—— |—— mymul.hpp
|   |—— |—— mymul.cpp
|   |—— hello.cpp
|   |—— main.cpp
|   |—— exercises.cpp
|   |—— CMakeLists.txt
|—— week04
|   |—— array.cpp
|   |—— stdstring.cpp
|   |—— struct.cpp
|   |—— union.cpp
|   |—— enum.cpp
|   |—— src
|   |—— |—— main.cpp
|   |—— |—— factorial.cpp
|   |—— |—— printhello.cpp
|   |—— |—— function.hpp
|   |—— CMakeLists.txt
|—— week05
|   |—— pointers.cpp
|   |—— pointer_array.cpp
|   |—— pointer_arithmetic.cpp
|   |—— stack_heap.cpp
|   |—— CMakeLists.txt
|—— week06
|   |—— src
|   |—— |—— main.cpp
|   |—— |—— math
|   |—— |—— |—— mymath.hpp
|   |—— |—— |—— mymath.cpp
|   |—— basic_function.cpp
|   |—— inline_function.cpp
|   |—— param_pointer.cpp
|   |—— param_reference.cpp
|   |—— CMakeLists.txt
|—— week08
|   |—— main.cpp
|   |—— matoperation.cpp
|   |—— matoperation.hpp
|   |—— CMakeLists.txt
|—— build
|—— bin
|—— CMakeLists.txt
|—— README.md

Context of Repo.

  • week01: Getting Started
  • week02: Data Types and Arithmetic Operators
  • week03: Branching and Looping Statements
  • week04: Data Structures
  • week05: Pointers and Dynamic Memory Management
  • week06: Basics of Functions
  • week07: Advances in Functions
  • week08: Speedup Your Program
  • week09: Basics of Classes
  • week10: Advances in Classes
  • week11: Dynamic Memory Management in Classes
  • week12: Class Inheritance and virtual function(polymorphic)
  • week13: Class Templates and std Library
  • week14: Error Handling
  • week15: Nested Classes and RTTI
  • 21days_CPlusPlus
  • Address-Book-System
  • EffectiveCPlusPlus
  • Essential-C++
  • mnist_MachineLearning
  • Modern_CPP_Overview
  • PrimerC-plus-plus_exercises
  • Staff-Management-System
  • Student-Management-System
  • Tetris-game

About

Modern CPlusPlus Guide; The Modern C++ to solve real-world problems; CMake构建复杂工程项目、C/C++学习例子、OpenCV for CPP,数字图像处理DIP,深度学习CUDA加速,GPU编程,OpenGL and QT。Linux Shell 常用命令,Ubuntu and Manjaro。

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published