导入
程序结构与编译工作流程
了解 C++ 构建过程,以理解源代码如何转换为可执行文件。
No configuration found for ID: 128ed362c3d05f2dbd1aa6b3f1ecc48d9d6d2a99174f12e928de9ca3322f27d0
代码示例
1// math_utils.hpp 2struct Point { 3 int x, y; 4};
代码示例
1// main.cpp (预处理后的概念视图) 2struct Point { int x, y; }; // 来自 math_utils.hpp 3struct Point { int x, y; }; // 来自 geometry.hpp(包含 math_utils.hpp)
1// math_utils.hpp 2#ifndef MATH_UTILS_HPP // 如果此标记未定义... 3#define MATH_UTILS_HPP // 现在定义它。 4 5struct Point { 6 int x, y; 7}; 8 9int add(int a, int b); 10 11#endif // 保护块结束。
代码示例
1// math_utils.hpp 2#pragma once 3 4struct Point { 5 int x, y; 6}; 7 8int add(int a, int b);