我想在Linux机器上编译一个opencv程序:
sav@machine:/shared/sav/test$ uname -a
Linux machine 2.6.32-24-generic #43-Ubuntu SMP Thu Sep 16 14:58:24 UTC 2010 x86_64 GNU/Linux
我的gcc命令如下:
gcc -I/shared/sav/opt/include -L/shared/sav/opt/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lm imagefilter.c -o imagefilter
运行程序后,我收到以下警告:
In file included from /shared/sav/opt/include/opencv2/core/core_c.h:47,
from /shared/sav/opt/include/opencv/cv.h:63,
from imagefilter.c:1:
/shared/sav/opt/include/opencv2/core/types_c.h: In function 'cvRound':
/shared/sav/opt/include/opencv2/core/types_c.h:327: warning: incompatible implicit declaration of built-in function 'lrint'
如何修复此警告?
答案 0 :(得分:1)
math.h
。-std=c99
选项和gcc
来解决此编译器问题。更改
gcc -I/shared/sav/opt/include -L/shared/sav/opt/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lm imagefilter.c -o imagefilter
到
gcc -std=c99 -I/shared/sav/opt/include -L/shared/sav/opt/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lm imagefilter.c -o imagefilter
有关lrint
的使用的详情,请参阅此处答案 1 :(得分:0)
包括以下头文件(math.h)。通常这个警告是因为不包括定义函数的头文件。
#include <math.h>