我在尝试构建此项目时遇到以下问题:
drazisil@Lightning:~/comical$ make -C src
make: Entering directory '/home/drazisil/comical/src'
Converting firstpage.png
...
make[1]: Entering directory `/home/travis/build/drazisil/comical/src'
`wx-config --cxx` `wx-config --cxxflags` -O2 -Wall -pipe -D_UNIX -I../unrar -I../unzip -c -o ComicalApp.o ComicalApp.cpp
In file included from ComicalFrame.h:43:0,
from ComicalManager.h:32,
from ComicalApp.h:32,
from ComicalApp.cpp:28:
firstpage.h:2:1: error: stray ‘#’ in program
原因似乎是因为在生成的 .h 文件的开头和结尾都插入了一个 -e
#ifndef _firstpage_png_h
-e #define _firstpage_png_h
static const unsigned char firstpage_png[] = {
...
...
...
-e };
#endif
由于我不确定该过程的哪一步导致了此问题,因此我不确定如何删除它,或者它甚至意味着什么。搜索 -e 效果不佳。
提前感谢您的帮助。
预计到达时间:生成文件:https://github.com/drazisil/comical/blob/dev/Makefile
最佳答案
问题是this target在 src/Makefile
文件中。
%.h : %.png
@echo "Converting" $<
@echo "#ifndef _"$*"_png_h" > $@
@echo -e "#define _"$*"_png_h\n" >> $@
@echo "static const unsigned char "$*"_png[] = {" >> $@
@hexdump -e "13/1 \"0x%02X, \" \"\n\"" $< | sed 's/0x ,//g' >> $@
@echo -e "};\n\n#endif" >> $@
具体来说,使用 echo -e
的两行试图在回显输出的末尾放置一个额外的换行符。
echo -e
是非标准的,您的 echo
shell/版本显然无法理解它。
将这些行重写为该目标会更好:
@printf '#define _$*_png_h\n\n' >> $@
@printf '};\n\n#endif\n' >> $@
对该目标的其他改进也是可能的,但超出了这个问题的范围(主要是使用单个 shell 命令和单个重定向而不是五个)。
关于c++ - <image>.h - 这个 -e 来自哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33088744/