C++ 编程:编译测试与 POSIX 套接字编程指南
1. 编译与测试
在开始编程之前,我们需要对代码进行编译和测试。编译代码时,我们可以使用与其他示例相同的CMakeLists.txt文件,其链接为:https://github.com/PacktPublishing/Hands-On-System-Programming-with-CPP/blob/master/Chapter09/CMakeLists.txt 。以下是编译和执行代码的具体步骤:
编译步骤:
> git clone https://github.com/PacktPublishing/Hands-On-System-Programming-with-CPP.git > cd Hands-On-System-Programming-with-CPP/Chapter09/ > mkdir build > cd build > cmake -DCMAKE_BUILD_TYPE=Release .. > make执行步骤:
> ./example7执行示例后,输出结果应类似于以下内容:
0x7ffca71d7a00 constructor, sizeof(T): 2