码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2018-12-27 13:29:48      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:9.png   upload   time   standard   eve   ref   simple   out   std   

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.

 

 

技术分享图片

 

 

技术分享图片

 

 

 技术分享图片

 

 技术分享图片

 

 

技术分享图片

 

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

标签:9.png   upload   time   standard   eve   ref   simple   out   std   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!