3838 :linenos:
3939
4040 add_program(example_single
41- src/example_single/index .cpp
41+ src/example_single/main .cpp
4242 )
4343
44- 这段代码添加了一个名为 ``example_single `` 的程序, 它由 src/example_single/index .cpp 源代码——src 文件夹里的 example_single 文件夹里的 main.cpp 源文件——组成.
44+ 这段代码添加了一个名为 ``example_single `` 的程序, 它由 src/example_single/main .cpp 源代码——src 文件夹里的 example_single 文件夹里的 main.cpp 源文件——组成.
4545
46- src/example_single/index .cpp 中有一个 :cpp: `int main() ` 函数, 它就是该程序执行的入口:
46+ src/example_single/main .cpp 中有一个 :cpp: `int main() ` 函数, 它就是该程序执行的入口:
4747
4848.. code-block :: cpp
4949 :linenos:
50- :caption: src/example_single/index .cpp
50+ :caption: src/example_single/main .cpp
5151
5252 #include "add.hpp"
5353
@@ -107,16 +107,16 @@ src/example_single/index.cpp 中有一个 :cpp:`int main()` 函数, 它就是该
107107 :linenos:
108108
109109 add_program(example_multiple
110- src/example_multiple/index .cpp
110+ src/example_multiple/main .cpp
111111 src/example_multiple/hello.cpp
112112 )
113113
114- 这段代码添加了一个名为 ``example_multiple `` 的程序, 它由 src/example_multiple/index .cpp 和 src/example_multiple/hello.cpp 中.
114+ 这段代码添加了一个名为 ``example_multiple `` 的程序, 它由 src/example_multiple/main .cpp 和 src/example_multiple/hello.cpp 中.
115115
116116
117117.. code-block :: cpp
118118 :linenos:
119- :caption: src/example_multiple/index .cpp
119+ :caption: src/example_multiple/main .cpp
120120
121121 #include "hello.hpp"
122122
@@ -126,7 +126,7 @@ src/example_single/index.cpp 中有一个 :cpp:`int main()` 函数, 它就是该
126126
127127 由源代码可知, 该程序的执行无非是以 :cpp: `int main() ` 函数为入口, 调用 :cpp: `hello() ` 函数.
128128
129- 为什么 src/example_multiple/index .cpp 会知道有个 :cpp: `hello() ` 函数呢? 因为 :cpp: `#include "hello.hpp" ` 所包含的头文件中书写了该函数的声明, 但是可以注意到的是, **该头文件中并没有定义 hello() 函数要干什么 **.
129+ 为什么 src/example_multiple/main .cpp 会知道有个 :cpp: `hello() ` 函数呢? 因为 :cpp: `#include "hello.hpp" ` 所包含的头文件中书写了该函数的声明, 但是可以注意到的是, **该头文件中并没有定义 hello() 函数要干什么 **.
130130
131131.. code-block :: cpp
132132 :linenos:
@@ -161,7 +161,7 @@ src/example_single/index.cpp 中有一个 :cpp:`int main()` 函数, 它就是该
161161 :linenos:
162162
163163 add_program(example_multiple
164- src/example_multiple/index .cpp # 定义程序入口函数 main, 它调用 hello 函数.
164+ src/example_multiple/main .cpp # 定义程序入口函数 main, 它调用 hello 函数.
165165 src/example_multiple/hello.cpp # 定义 hello 函数
166166 )
167167
@@ -184,11 +184,11 @@ src/example_single/index.cpp 中有一个 :cpp:`int main()` 函数, 它就是该
184184 :linenos:
185185
186186 add_program(example_multiple
187- src/example_multiple/index .cpp # 定义程序入口函数 main, 它调用 hello 函数.
187+ src/example_multiple/main .cpp # 定义程序入口函数 main, 它调用 hello 函数.
188188 src/example_multiple/hello.cpp # 定义 hello 函数
189189 )
190190 add_program(example_multiple2
191- src/example_multiple/index .cpp # 同样用 main.cpp
191+ src/example_multiple/main .cpp # 同样用 main.cpp
192192 src/example_multiple/hello2.cpp # 用另一种方式定义 hello 函数
193193 )
194194
0 commit comments