删除某些标题后错误 LNK1120 已解决,但随后出现另一个错误(错误错误 C3861: 'cvPyrSegmentation': identifier not found ) [英] Error LNK1120 Solved After Removing Some Header, But Then There Is Another Error(Error error C3861: 'cvPyrSegmentation': identifier not found )

查看:21
本文介绍了删除某些标题后错误 LNK1120 已解决,但随后出现另一个错误(错误错误 C3861: 'cvPyrSegmentation': identifier not found )的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上下面的代码是我试图执行的.当我尝试使用 Microsoft Visual Studio 2012 执行此操作时,出现错误.

Actually the coding below is what I tried to execute. When I tried to execute this using Microsoft Visual Studio 2012, there is an error.

错误错误 LNK2019:函数void __cdecl START_SEGMENT(int)"(?START_SEGMENT@@YAXH@Z) 中引用的未解析的外部符号 _cvPyrSegmentation

错误错误 LNK1120:1 个未解析的外部

但是我让我的朋友用他的笔记本电脑执行这段代码,它工作得很好.没有错误.但是他用的是Microsoft Visual Studio 2010,而不是我用的是Visual Studio 2012..我想知道为什么我执行这段代码时会出错,而我朋友执行时却没有错误.

But I asked my friend to execute this code using his laptop, it works just fine.No error. But he is using Microsoft Visual Studio 2010 instead of me using Visual Studio 2012..I wonder why there is an error when I execute this code but when my friend execute it, no error.

所以我删除了一些标题,编码看起来就像我从一开始问的那样(来自这个 ​​问题.带有 ""Error error C3861: 'cvPyrSegmentation': identifier not found ""..删除一些标题后,不再有错误 LNK1120.但是有"错误错误C3861:'cvPyrSegmentation':标识符未找到"...

So I removed some header and the coding looks like the one that I ask from the beginning( from this Question.The one with ""Error error C3861: 'cvPyrSegmentation': identifier not found "".. After I removed some header, there is no more Error LNK1120. But there is ""Error error C3861: 'cvPyrSegmentation': identifier not found""...

空白...对于新手来说错误太多.学习过程绝非易事.是啊!

Blank ...Too many error for a newbie.Learning process never be easy .yeahhh!

#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/legacy/legacy.hpp>
#include <stdio.h>

static void help(void)
{
  printf("\nThis program present the function of pyramid segmentation which is   
        cvcvPyrSegmentation()\n""we can controlled the value of threshold by creating 
        the taskbar\n""Usage :\n");            
}

IplImage*  image[2] = { 0, 0 }, *image0 = 0, *image1 = 0;
CvSize size;

int  w0, h0,i;
int  threshold1, threshold2;
int  l,level = 4;
int sthreshold1, sthreshold2;
int  l_comp;
int block_size = 1000;
float  parameter;
double threshold;
double rezult, min_rezult;
int filter = CV_GAUSSIAN_5x5;
CvConnectedComp *cur_comp, min_comp;
CvSeq *comp;
CvMemStorage *storage;

 CvPoint pt1, pt2;

  static void START_SEGMENT(int a)
{
   (void) a;
   cvPyrSegmentation(image0, image1, storage, &comp, level, threshold1+1,   
   threshold2+1);

  cvShowImage("Segmentation", image1);
}


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

  help();

  filename = argc == 2 ? argv[1] : (char*)"C:/Users/acer/Documents/Visual Studio  
  2012/Projects/me2.jpg";

  if( (image[0] = cvLoadImage( filename, 1)) == 0 )
{
    help();
    printf("Cannot load fileimage - %s\n", filename);
    return -1;
}


cvNamedWindow("Source", 0);
cvShowImage("Source", image[0]);

cvNamedWindow("Segmentation", 0);

storage = cvCreateMemStorage ( block_size );

image[0]->width &= -(1<<level);
image[0]->height &= -(1<<level);

image0 = cvCloneImage( image[0] );
image1 = cvCloneImage( image[0] );
// segmentation of the color image
l = 1;
threshold1 =255;
threshold2 =30;

START_SEGMENT(1);

sthreshold1 = cvCreateTrackbar("Threshold1", "Segmentation", &threshold1, 255,   
START_SEGMENT);
sthreshold2 = cvCreateTrackbar("Threshold2", "Segmentation",  &threshold2, 255, 
START_SEGMENT);

cvShowImage("Segmentation", image1);
cvWaitKey(0);

cvDestroyWindow("Segmentation");
cvDestroyWindow("Source");

cvReleaseMemStorage(&storage );

cvReleaseImage(&image[0]);
cvReleaseImage(&image0);
cvReleaseImage(&image1);

return 0;
}

#ifdef _EiC
main(1,"pyramid_segmentation.c");
#endif

推荐答案

解决了编译问题后,您现在遇到了链接器问题.

Having fixed your compilation problem, you now have a linker problem.

您需要按照 OpenCV 文档中的说明了解如何将他们的库链接到您的二进制文件.

You need to follow the instructions in the OpenCV documentation to find out how to link their libraries to your binary.

您将从 -lcv 开始,并且可能需要添加一些额外的库.

You'll start with -lcv and potentially have to add some additional libraries.

这篇关于删除某些标题后错误 LNK1120 已解决,但随后出现另一个错误(错误错误 C3861: 'cvPyrSegmentation': identifier not found )的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆