Modern C++ Course [Lecture 2] {Compilation, Debugging, Functions, Header/Source, Libraries, CMake}

http://www.ipb.uni-bonn.de/wp-content/uploads/2018/05/lecture_2.pdf



 make bash file executable

Wall: Warning all

Wextra: add even more extra Warning

Werror: treat Warnings as errors

by default, there‘s no optimization.

-O0

-O3 -Ofaster

"segmentation fault" means you are using some unallowed memory.

use reference to avoid copy, and save a lot time!

 explaining how reference as function variable works.

Announce default variables only in declaration (typo above...).

sort, sumation, multiplication standard operation in std::vector

every header file should include "#pragma once", otherwise you would get wierd errors.

the compiler doesn‘t know the definition of the test.cpp.

simply add the 2nd line will make the "c++ main.cpp ... " work, but no output!

build the test.cpp first, and include the result .o file into main.cpp building.

     c++ workflow!!!

.o file is binary and only machine can read it.

 maybe there‘s a branch of changing now in makefile. but this file is simple and readable.

原文地址:https://www.cnblogs.com/ecoflex/p/10182982.html

时间: 2024-11-05 17:53:22

Modern C++ Course [Lecture 2] {Compilation, Debugging, Functions, Header/Source, Libraries, CMake}的相关文章

Modern C++ Course [Lecture 7] {Pointers, const with pointers, Stack and Heap, Memory leaks, Dangling pointers}

https://en.cppreference.com/w/cpp/language/range-for every object has a pointer to itsleft. stack operations are very quick it's computationally expensive to search variables in a stack, when the scopes and functions are very large. So, keep your sco

Modern C++ Course [Lecture 6] {Static, Numbers in memory, Raw C arrays, Non-owning pointers, Classes in memory}

every object of the same class can equally gets access to the static variable float has limited precision, eg, float x = 1.0; but x = 0.99999987 things like this. destroy precision of demicals when add huge numbers to small numbers  set precision(20)

Introduction to Cortex Serial Wire Debugging

Serial Wire Debug (SWD) provides a debug port for severely pin limited packages, often the case for small package microcontrollers but also complex ASICs where limiting pin-count is critical and can be the controlling factor in device costs. SWD repl

《Effective Modern C++》要点中英文对照

目录 CHAPTER 1 Deducing Types 章节1 类型推导 Item 1:Understand template type deduction. 条款1:理解模板类型推导. Item 2:Understand auto type deduction. 条款2:理解auto类型推导. Item 3:Understand decltype. 条款3:理解decltype. Item 4:Know how to view deduced types. 条款4:知道如何查看推导出来的类型.

Use Reentrant Functions for Safer Signal Handling(译:使用可重入函数进行更安全的信号处理)

Use Reentrant Functions for Safer Signal Handling 使用可重入函数进行更安全的信号处理 How and when to employ reentrancy to keep your code bug free 何时及如何利用可重入性避免代码缺陷 Dipak Jha (mailto:[email protected]?subject=Use reentrant functions for safer signal handling&[email pr

Pre-compile (pre-JIT) your assembly on the fly, or trigger JIT compilation ahead-of-time (转)

Introduction All .NET developers know that one of the best features of the CLR is JIT-compilation: Just-In-Time compilation. Its name describes how it works: right before calling your method (just in time), the CLR triggers the JIT-compiler to produc

5.24 Declaring Attributes of Functions【转】

转自:https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html 5.24 Declaring Attributes of Functions In GNU C, you declare certain things about functions called in your program which help the compiler optimize function calls and check your

【干货】国外程序员整理的 C++ 资源大全【转】

来自 https://github.com/fffaraz/awesome-cpp A curated list of awesome C/C++ frameworks, libraries, resources, and shiny things. Inspired by awesome-... stuff Standard Libraries C++ Standard Library - including STL Containers, STL Aglorithm, STL Functio

Making your first driver - complete walkthrough(使用VisualDDK)

This article describes how to create, build and debug your first driver using Visual Studio and VisualDDK. It provides detailed step-by-step instructions on using the development and debugging tools, leaving the driver API and architecture descriptio