(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
关于此问题,有专门文档说明,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
基础知识: