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

时间:2015-05-09 21:22:01

标签: c++ visual-studio-2013

您好我正在尝试使用网络摄像头运行开源c ++代码来跟踪对象 我在构建项目时遇到了这个问题 我正在使用visual studio 2013

错误如下

Error   432 error LNK2019: unresolved external symbol "extern "C" struct _IplImage * __cdecl cvCreateImage(struct CvSize,int,int)" (?cvCreateImage@@$$J0YAPAU_IplImage@@UCvSize@@HH@Z) referenced in function "void __clrcall `dynamic initializer for 'image2''(void)" (???__Eimage2@@YMXXZ@?A0x3871e7ff@@$$FYMXXZ)    C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\Sentry Project.obj    sentry 
Error   433 error LNK2019: unresolved external symbol __imp__EncodePointer@4 referenced in function _pre_c_init C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(crtexew.obj)  sentry
Error   434 error LNK2001: unresolved external symbol __imp__EncodePointer@4    C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(atonexit.obj) sentry
Error   435 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(crtexew.obj)  sentry
Error   436 error LNK2019: unresolved external symbol __imp__IsDebuggerPresent@0 referenced in function ___raise_securityfailure    C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(gs_report.obj)    sentry
Error   437 error LNK2019: unresolved external symbol _IsProcessorFeaturePresent@4 referenced in function ___report_gsfailure   C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(gs_report.obj)    sentry
Error   438 error LNK2001: unresolved external symbol _IsProcessorFeaturePresent@4  C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(cpu_disp.obj) sentry
Error   439 error LNK2019: unresolved external symbol __imp__QueryPerformanceCounter@4 referenced in function ___security_init_cookie   C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(gs_support.obj)   sentry
Error   440 error LNK2019: unresolved external symbol __imp__GetCurrentProcessId@0 referenced in function ___security_init_cookie   C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(gs_support.obj)   sentry
Error   441 error LNK2019: unresolved external symbol __imp__GetCurrentThreadId@0 referenced in function ___security_init_cookie    C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(gs_support.obj)   sentry
Error   442 error LNK2019: unresolved external symbol __imp__GetSystemTimeAsFileTime@4 referenced in function ___security_init_cookie   C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(gs_support.obj)   sentry
Error   443 error LNK2019: unresolved external symbol __imp__DecodePointer@4 referenced in function __onexit    C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCRTD.lib(atonexit.obj) sentry
Error   444 error LNK2019: unresolved external symbol "extern "C" void __stdcall Sleep(unsigned long)" (?Sleep@@$$J14YGXK@Z) referenced in function __catch$?_Initialize@LanguageSupport@<CrtImplementationDetails>@@$$FAAEXXZ$0    C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\MSVCMRTD.lib(mstartup.obj)    sentry
Error   445 error LNK2001: unresolved external symbol __CorExeMain@0    C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\LINK  sentry`

我将这些lib包含在Linker&gt;&gt;输入&gt;&gt; Aditional依赖项中 KERNEL32.LIB USER32.LIB GDI32.LIB winspool.lib comdlg32.lib advapi32.lib SHELL32.LIB ole32.lib oleaut32.lib UUID.LIB odbc32.lib odbccp32.lib

任何帮助请我毕业项目还需要两周时间:(

以下是代码可以任何正文告诉我如何修复此类

#include <cmath>
#include <iostream>
using namespace std;

#if (defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) || (defined(__APPLE__) & defined(__MACH__)))
#include <cv.h>
#else
#include <opencv/cv.h>
#endif

#include "cvblob.h"

namespace cvb
{

  CvScalar cvBlobMeanColor(CvBlob const *blob, IplImage const *imgLabel, IplImage const *img)
  {
    CV_FUNCNAME("cvBlobMeanColor");
    __CV_BEGIN__;
    {
      CV_ASSERT(imgLabel&&(imgLabel->depth==IPL_DEPTH_LABEL)&&(imgLabel->nChannels==1));
      CV_ASSERT(img&&(img->depth==IPL_DEPTH_8U)&&(img->nChannels==3));

      int stepLbl = imgLabel->widthStep/(imgLabel->depth/8);
      int stepImg = img->widthStep/(img->depth/8);
      int imgLabel_width = imgLabel->width;
      int imgLabel_height = imgLabel->height;
      int imgLabel_offset = 0;
      int img_width = img->width;
      int img_height = img->height;
      int img_offset = 0;
      if(imgLabel->roi)
      {
    imgLabel_width = imgLabel->roi->width;
    imgLabel_height = imgLabel->roi->height;
    imgLabel_offset = (imgLabel->nChannels * imgLabel->roi->xOffset) + (imgLabel->roi->yOffset * stepLbl);
      }
      if(img->roi)
      {
    img_width = img->roi->width;
    img_height = img->roi->height;
    img_offset = (img->nChannels * img->roi->xOffset) + (img->roi->yOffset * stepImg);
      }

      CvLabel *labels = (CvLabel *)imgLabel->imageData + imgLabel_offset;
      unsigned char *imgData = (unsigned char *)img->imageData + img_offset;

      double mb = 0;
      double mg = 0;
      double mr = 0;
      double pixels = (double)blob->area;

      for (unsigned int r=0; r<(unsigned int)imgLabel_height; r++, labels+=stepLbl, imgData+=stepImg)
    for (unsigned int c=0; c<(unsigned int)imgLabel_width; c++)
    {
      if (labels[c]==blob->label)
      {
        mb += ((double)imgData[img->nChannels*c+0])/pixels; // B
        mg += ((double)imgData[img->nChannels*c+1])/pixels; // G
        mr += ((double)imgData[img->nChannels*c+2])/pixels; // R
      }
    }

      /*double mb = 0;
      double mg = 0;
      double mr = 0;
      double pixels = (double)blob->area;
      for (unsigned int y=0; y<imgLabel->height; y++)
    for (unsigned int x=0; x<imgLabel->width; x++)
    {
      if (cvGetLabel(imgLabel, x, y)==blob->label)
      {
        CvScalar color = cvGet2D(img, y, x);
        mb += color.val[0]/pixels;
        mg += color.val[1]/pixels;
        mr += color.val[2]/pixels;
      }
    }*/

      return cvScalar(mr, mg, mb);
    }
    __CV_END__;
  }

}

这是错误

Error   4   error LNK2028: unresolved token (0A000A10) "extern "C" void
__cdecl cvError(int,char const *,char const *,char const *,int)" (?cvError@@$$J0YAXHPBD00H@Z) referenced in function "extern "C" struct CvScalar __cdecl cvBlobMeanColor(struct cvb::CvBlob const *,struct
_IplImage const *,struct _IplImage const *)" (?cvBlobMeanColor@@$$J0YA?AUCvScalar@@PBUCvBlob@cvb@@PBU_IplImage@@1@Z)    
C:\Users\tskhalil\Desktop\openvisionc-code-17-trunk\openvisionc-code-17-trunk\cvcolor.obj   sentry

0 个答案:

没有答案