我仔细查看了源代码明明正确在头文件datetime.h声明了getDateText,并且在datetime.c文件中实现了getDateText这个函数,并且在log.c文件中按照相对路径正确引入了datetime.h,但是编译一直报如下错误,看了一晚上都没明白是怎么回事。
log/liblog.a(log.c.o):在函数‘write_log’中:
log.c:(.text+0x41):对‘getDateText’未定义的引用
我的项目在此 https://github.com/cw1997/ezs...
手动gcc -o run main.c datetime.h datetime.c log/log.h log/log.c编译没问题 但是用了cmake编译就出问题了,我怀疑是cmake配置问题。