• 欢迎浏览“String me = Creater\忠实的资深Linux玩家;”,请文明浏览,理性发言,有侵犯你的权益请邮件我(creater@vip.qq.com).
  • 把任何的失败都当作一次尝试,不要自卑;把所有的成功都想成是一种幸运,不要自傲。
  •    5年前 (2013-08-05)  OpenCv |   5 条评论  8 
    文章评分 0 次,平均分 0.0

    1.在make时出现如下错误
    In file included from _cxcore.h:60,
    from cxalloc.cpp:42:
    ../../cxcore/include/cxmisc.h:133:6: error: #elif with no expression
    make[3]: *** [cxalloc.lo] 错误 1
    解决办法:
    修改cxcore/include/cxmisc.h的133行的#elif为#else,保存退出。

     

     

    2.使用如下的shell命令编译例程中的例子

    g++ `pkg-config opencv --libs --cflags opencv` -lcv drawing.c -o drawing -L/usr/local/lib -I/usr/local/include/opencv

    出现错误:
    Package opencv was not found in the pkg-config search path.
    Perhaps you should add the directory containing `opencv.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'opencv' found
    Package opencv was not found in the pkg-config search path.
    Perhaps you should add the directory containing `opencv.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'opencv' found
    /tmp/ccU02C6B.o: In function `main':
    drawing.c:(.text+0x119): undefined reference to `cvNamedWindow'
    drawing.c:(.text+0x13d): undefined reference to `cvShowImage'
    drawing.c:(.text+0x329): undefined reference to `cvShowImage'
    drawing.c:(.text+0x335): undefined reference to `cvWaitKey'
    drawing.c:(.text+0x4e8): undefined reference to `cvShowImage'
    drawing.c:(.text+0x4f4): undefined reference to `cvWaitKey'
    drawing.c:(.text+0x72c): undefined reference to `cvShowImage'
    drawing.c:(.text+0x738): undefined reference to `cvWaitKey'
    drawing.c:(.text+0xa52): undefined reference to `cvShowImage'
    drawing.c:(.text+0xa5e): undefined reference to `cvWaitKey'
    drawing.c:(.text+0xd41): undefined reference to `cvShowImage'
    drawing.c:(.text+0xd4d): undefined reference to `cvWaitKey'
    drawing.c:(.text+0xecc): undefined reference to `cvShowImage'
    drawing.c:(.text+0xed8): undefined reference to `cvWaitKey'
    drawing.c:(.text+0x1178): undefined reference to `cvShowImage'
    drawing.c:(.text+0x1184): undefined reference to `cvWaitKey'
    drawing.c:(.text+0x1375): undefined reference to `cvShowImage'
    drawing.c:(.text+0x1381): undefined reference to `cvWaitKey'
    drawing.c:(.text+0x13a3): undefined reference to `cvWaitKey'
    drawing.c:(.text+0x13cb): undefined reference to `cvDestroyWindow'
    collect2: ld 返回 1
    由提示得到解决办法:
    需要让pkg-config找到opencv.pc
    所以执行下面的shell

    cp opencv.pc  /usr/lib/pkgconfig/

     

    除特别注明外,本站所有文章均为String me = "Creater\忠实的资深Linux玩家";原创,转载请注明出处来自http://unix8.net/home.php/1812.html

    关于

    发表评论

    暂无评论

    切换注册

    登录

    忘记密码 ?

    切换登录

    注册

    扫一扫二维码分享