《C++ Primer》随附代码的使用方法

(Source: C++ Primer, Fifth Edition Visual Studio 2012 Code Distribution README )

Conditional Compilation

第5版包含C++11新特性的介绍,但VS 2012还不完全支持C++11,于是作者通过条件编译,规避了使用了C++11特性的代码不能在VS2012上顺利编译的问题。


示意代码:

#ifdef VARIABLE_NAME
code1 // this code will be compiled if VARIABLE_NAME has been defined
#else
code2 // this code will be compiled if VARIABLE_NAME has not been defined
#endif


The preprocessor variables that correspond to unimplemented features are defined in Version test.h

关于此问题,有专门文档说明,CompilerNotes.pdf

鉴于我用的是VS2017,基本不存在条件编译的问题。因此具体细节等学到条件编译(Section 6.5.3  )的时候再回头看。

Building Executables

资源中随附了makefile方便使用nmake统一编译。

# Windows machines
> nmake # compiles all the programs
> nmake clean # removes all the object files and stackdumps
> nmake clobber # removes executable, object and stackdump files

基础知识:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值