【问题标题】:cvNamedwindow not working in opencv on eclipse on ubuntu 11.10cvNamedwindow 在 ubuntu 11.10 上的 Eclipse 上无法在 opencv 中工作
【发布时间】:2012-01-30 22:54:39
【问题描述】:

这是显示 AVI 视频的代码 sn-p,它可以工作。

int main( int argc, char** argv ) {

//    cvNamedWindow( “Example2”, CV_WINDOW_AUTOSIZE );

CvCapture* capture = cvCreateFileCapture( "video.avi" );
IplImage* frame;

while(1) {

    frame = cvQueryFrame( capture );
    if( !frame ) break;
    cvShowImage( "Example2", frame );
    char c = cvWaitKey(33);
    if( c == 27 ) break;

}

cvReleaseCapture( &capture );
cvDestroyWindow( "Example2" );

return 0;
}

但是,当我从第二行删除注释 // 时,它不起作用。我得到的错误是:

Invoking: GCC C Compiler
gcc -I/usr/include/opencv -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o"main.o" "../main.c"
../main.c: In function ‘main’:
../main.c:5:5: error: stray ‘\342’ in program
../main.c:5:5: error: stray ‘\200’ in program
../main.c:5:5: error: stray ‘\234’ in program
../main.c:5:5: error: stray ‘\342’ in program
../main.c:5:5: error: stray ‘\200’ in program
../main.c:5:5: error: stray ‘\235’ in program
../main.c:5:23: error: ‘Example2’ undeclared (first use in this function)
../main.c:5:23: note: each undeclared identifier is reported only once for each function it appears in
make: *** [main.o] Error 1

“Example2”如何未声明? cvNamedwindow 不应该做这项工作吗?

【问题讨论】:

    标签: c eclipse ubuntu opencv


    【解决方案1】:
    cvNamedWindow( “Example2”, CV_WINDOW_AUTOSIZE );
    

    这些是一些非常有趣的报价。尝试用标准引号替换它们:" 并重新编译。

    【讨论】:

    • 谢谢。我从电子书中复制了代码。这就是我猜的问题。
    猜你喜欢
    • 2011-12-08
    • 1970-01-01
    • 1970-01-01
    • 2011-12-15
    • 1970-01-01
    • 2013-05-12
    • 1970-01-01
    • 2014-12-11
    • 2011-12-19
    相关资源
    最近更新 更多