Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
感谢小彭老师的课程,这是我完成的作业1。
我发现了下面这几个问题:
add_definitions通过了?因为add_definitions给当前目录下和所有添加的子目录都添加一个DEFINITION,而不会给包含它的上级目录添加,相当于是默认的PRIVATE。target_compile_definitions(stbiw PUBLIC -DSTB_IMAGE_WRITE_IMPLEMENTATION=1)不通过?因为mandel.h和rainbow.h都include了stbiw库,所以如果在CMakeLists.txt中设置宏,会导致这个宏被定义了两次,发生冲突。如果在某个源文件中定义这个宏,由于头文件使用#ifdef INCLUDE_STB_IMAGE_WRITE_H来标志函数实现的源码只被包含一次,所以不会发生冲突。应该在CMakeLists.txt文件中将宏设置为PRIVATE,这样这个宏就不会传递到包含它的项目中,从而避免了重定义。INTERFACE关键字。由于STB_IMAGE里用的是#ifdef而不是#ifndef,不能只修改CMakeLists.txt而不修改某一个cpp源文件,因此pull/14只能去修改main.cpp,不符合要求。