Skip to content

Conversation

@Bigwind110
Copy link

这条命令创建了一个名为 stbiw 的静态库。
STATIC 表示这是一个静态库。
stb_image_write.cpp 是这个库的源文件。
target_include_directories(stbiw PUBLIC .):
这条命令为目标 stbiw 设置了头文件搜索路径。
PUBLIC 表示这个路径不仅在编译 stbiw 时使用,还会在编译任何依赖 stbiw 的目标时使用。 . 表示当前目录。

stb设计为头文件库,设计的初衷就是通过一个头文件提供所有功能。通过这种方式,可以简化库的使用和集成。这样,stb_image_write 库的所有函数就会在这个 .cpp 文件中实现,而在其他文件中只需要包含 stb_image_write.h 即可使用这些函数。

pragma once使程序编译只包含一次,可以加快编译速度

这条命令创建了一个名为 stbiw 的静态库。
STATIC 表示这是一个静态库。
stb_image_write.cpp 是这个库的源文件。
target_include_directories(stbiw PUBLIC .):
这条命令为目标 stbiw 设置了头文件搜索路径。
PUBLIC 表示这个路径不仅在编译 stbiw 时使用,还会在编译任何依赖 stbiw 的目标时使用。
. 表示当前目录。

stb设计为头文件库,设计的初衷就是通过一个头文件提供所有功能。通过这种方式,可以简化库的使用和集成。这样,stb_image_write 库的所有函数就会在这个 .cpp 文件中实现,而在其他文件中只需要包含 stb_image_write.h 即可使用这些函数。

pragma once使程序编译只包含一次,可以加快编译速度
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant