C++ Learning Notes

C++ Learning Notes

Tags
Notes
Published
February 20, 2025
Last Updated
Last updated February 20, 2025
Author
Eddie He
Featured
Slug

Punctuation Marks

 

Using GCC with MinGW

 

Run msys2-ucrt64 in Windows Terminal

 

tasks.json

{ "tasks": [ { "type": "cppbuild", "label": "C/C++: g++.exe build active file", "command": "C:\\msys64\\ucrt64\\bin\\g++.exe", "args": [ // "-static", "-fdiagnostics-color=always", "-g", "${file}", "-I", "${workspaceFolder}/Dependencies/GLFW/include/GLFW", // "-L", // "${workspaceFolder}/Dependencies/GLFW/lib-static-ucrt", // "-lglfw3dll", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe" ], "options": { // Different from the official docs "cwd": "C:\\msys64\\ucrt64\\bin" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "Task generated by Debugger." } ], "version": "2.0.0" }
 

launch.json

{ "version": "0.2.0", "configurations": [ { "name": "C/C++: g++.exe build and debug active file", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "MIMode": "gdb", // your gdb.exe filepath "miDebuggerPath": "C:\\msys64\\ucrt64\\bin\\gdb.exe", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true }, { "description": "Set Disassembly Flavor to Intel", "text": "-gdb-set disassembly-flavor intel", "ignoreFailures": true } ], "preLaunchTask": "C/C++: g++.exe build active file" } ] }
 

c_cpp_properties.json

{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**", // "${workspaceFolder}/Dependencies/GLFW/include/GLFW" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "windowsSdkVersion": "10.0.22621.0", // your g++.exe filepath "compilerPath": "C:/msys64/ucrt64/bin/g++.exe", "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "${default}" } ], "version": 4 }
 

The cherno Notes

 

OpenCV Courses

 

Forgetting Zone

Should I prefer std::string_view or const std::string& function parameters?
Prefer std::string_view in most cases.