ez8-co / emock

🐞 下一代C/C++跨平台mock库 (Next generation cross-platform mock library for C/C++)
Apache License 2.0
118 stars 35 forks source link

defined but not used [-Wunused-function] #35

Open ejoful opened 1 year ago

ejoful commented 1 year ago

1.问题现象 编译时出现如下报错: emock/types/ValueHolder.h:54:13: warning: ‘emock::Constraint emock::{anonymous}::constraint(const emock::Constraint)’ defined but not used [-Wunused-function] Constraint constraint(const Constraint c) 2.问题分析 在C程序中,如果定义了一个静态函数或变量,而没有去使用,编译时会有一个警告: 'at_wait_send_finish' defined but not used [-Wunused-function], 当前报错是由于函数定义在 .h 头文件中,但是没有使用。 3.解决办法 把函数定义在 .cpp 源文件中 4.参考信息: https://stackoverflow.com/questions/2845748/function-defined-but-not-used-warning-in-c https://blog.csdn.net/hanhui22/article/details/108869744

orca-zhang commented 1 year ago

收到,感谢反馈