Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ejoful opened this issue Dec 9, 2022 · 1 comment
Open

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

ejoful opened this issue Dec 9, 2022 · 1 comment

Comments

@ejoful
Copy link

ejoful commented Dec 9, 2022

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
Copy link
Contributor

收到,感谢反馈

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

No branches or pull requests

2 participants