简体   繁体   English

cvBlobsLib外部链接错误..请帮助我

[英]cvBlobsLib external link error..please help me

today I've compiled "cvblobslib" for Windows with OpenCV in my Visual Studio C++ 2010. 今天我在Visual Studio C ++ 2010中使用OpenCV为Windows编译了“cvblobslib”。

Compilation goes OK, and I obtain "cvblobslib.lib". 编译顺利,我获得“cvblobslib.lib”。

I've follow the istruction on library to set Visual C++ in my project to use this library (C++ additional directories and other) like in the instructions, that I quote here: 我按照库中的istruction来设置我的项目中的Visual C ++来使用这个库(C ++其他目录和其他),就像我在这里引用的那样:

"1 - open the project of the library and build it (OK, done) 2 - in the project where the library should be used, add: “1 - 打开库的项目并构建它(OK,done)2 - 在应该使用库的项目中,添加:

2.1 In "Project/Settings/C++/Preprocessor/Additional Include directories" add the directory where the blob library is stored (done) 2.1在“项目/设置/ C ++ /预处理器/其他包含目录”中,添加存储blob库的目录(完成)

2.2 In "Project/Settings/Link/Input/Additional library path" add the directory where the blob library is stored and in "Object/Library modules" add the cvblobslib.lib file (where? In the visual studio folder or in my project folder?) 2.2在“项目/设置/链接/输入/附加库路径”中添加存储blob库的目录,并在“对象/库模块”中添加cvblobslib.lib文件(在哪里?在visual studio文件夹或我的项目中)夹?)

3- Include the file "BlobResult.h" where you want to use blob variables (OK, done) 3-包含要使用blob变量的文件“BlobResult.h”(确定,已完成)

NOTE: Verify that in the project where the cvblobslib.lib is used, the MFC Runtime Libraries are not mixed: 注意:验证在使用cvblobslib.lib的项目中,MFC运行时库不会混合:

  1. Check in "Project->Settings->C/C++->Code Generation->Use run-time library" of your project and set it to Debug Multithreaded DLL (debug version ) or to Multithreaded DLL ( release version ). 检查项目的“项目 - >设置 - > C / C ++ - >代码生成 - >使用运行时库”,并将其设置为Debug Multithreaded DLL(调试版)或Multithreaded DLL(发行版)。 2 Check in "Project->Settings->General" how it uses the MFC. 2检查“项目 - >设置 - >常规”如何使用MFC。 It should be "Use MFC in a shared DLL". 它应该是“在共享DLL中使用MFC”。 (done) (完成)

Can anyones help me, because with this code: 任何人都可以帮助我,因为这段代码:

#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <opencv2\highgui\highgui.hpp>
#include <opencv\cxcore.h>
#include <stdio.h>
#include <conio.h>

// Main blob library include
#include "BlobResult.h"


using namespace std;
using namespace cv;


int main()
{

CBlobResult blobs;
int i;
CBlob *currentBlob;
IplImage *original,*originalThr,*displayedImage;

//carica immagine
original = cvLoadImage("pic6.png", CV_LOAD_IMAGE_GRAYSCALE);
cvThreshold(original,originalThr,100,255,CV_THRESH_BINARY);

//cerca le blob non bianche
blobs = CBlobResult(originalThr,NULL,255);

//le esclude quelle più piccole del parametro 2
blobs.Filter(blobs, B_EXCLUDE, CBlobGetArea(), B_LESS, 80);

//prende le parti grigie delle blob più grandi
CBlob biggestBlob;
CBlobGetMean getMeanColor(original);
double meanGray;

blobs.GetNthBlob(CBlobGetArea(), 0, biggestBlob);
meanGray = getMeanColor(biggestBlob);

//display it
cvMerge(originalThr,originalThr,originalThr,NULL, displayedImage);

for(i=0; i<blobs.GetNumBlobs();i++)
{
    currentBlob = blobs.GetBlob(i);
    currentBlob->FillBlob(displayedImage, CV_RGB(255,0,0));
}

return 0;

}

I obtain this errors: 我得到了这个错误:

1>------ Inizio compilazione: Progetto: prova64, Configurazione: Debug x64 ------
1>Compilazione avviata 13/09/2013 15:31:44.
1>InitializeBuildStatus:
1>  Aggiornamento timestamp di "x64\Debug\prova64.unsuccessfulbuild".
1>ClCompile:
1>  Tutti gli output sono aggiornati.
1>ManifestResourceCompile:
1>  Tutti gli output sono aggiornati.
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: __cdecl CBlob::~CBlob(void)" (??1CBlob@@QEAA@XZ) non risolto nella funzione main
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: void __cdecl CBlob::FillBlob(struct _IplImage *,struct CvScalar,int,int)" (?FillBlob@CBlob@@QEAAXPEAU_IplImage@@UCvScalar@@HH@Z) non risolto nella funzione main
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: class CBlob * __cdecl CBlobResult::GetBlob(int)" (?GetBlob@CBlobResult@@QEAAPEAVCBlob@@H@Z) non risolto nella funzione main
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: void __cdecl CBlobResult::GetNthBlob(class COperadorBlob *,int,class CBlob &)const " (?GetNthBlob@CBlobResult@@QEBAXPEAVCOperadorBlob@@HAEAVCBlob@@@Z) non risolto nella funzione main
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: __cdecl CBlob::CBlob(void)" (??0CBlob@@QEAA@XZ) non risolto nella funzione main
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: void __cdecl CBlobResult::Filter(class CBlobResult &,int,class COperadorBlob *,int,double,double)" (?Filter@CBlobResult@@QEAAXAEAV1@HPEAVCOperadorBlob@@HNN@Z) non risolto nella funzione main
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: virtual __cdecl CBlobResult::~CBlobResult(void)" (??1CBlobResult@@UEAA@XZ) non risolto nella funzione main
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: class CBlobResult & __cdecl CBlobResult::operator=(class CBlobResult const &)" (??4CBlobResult@@QEAAAEAV0@AEBV0@@Z) non risolto nella funzione main
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: __cdecl CBlobResult::CBlobResult(struct _IplImage *,struct _IplImage *,unsigned char)" (??0CBlobResult@@QEAA@PEAU_IplImage@@0E@Z) non risolto nella funzione main
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: __cdecl CBlobResult::CBlobResult(void)" (??0CBlobResult@@QEAA@XZ) non risolto nella funzione main
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: double __cdecl CBlob::Mean(struct _IplImage *)" (?Mean@CBlob@@QEAANPEAU_IplImage@@@Z) non risolto nella funzione "public: virtual double __cdecl CBlobGetMean::operator()(class CBlob &)" (??RCBlobGetMean@@UEAANAEAVCBlob@@@Z)
1>testeblob.obj : error LNK2019: riferimento al simbolo esterno "public: double __cdecl CBlob::Area(void)" (?Area@CBlob@@QEAANXZ) non risolto nella funzione "public: virtual double __cdecl CBlobGetArea::operator()(class CBlob &)" (??RCBlobGetArea@@UEAANAEAVCBlob@@@Z)
1>C:\OPENCV\Test\Elabora64\prova64\x64\Debug\prova64.exe : fatal error LNK1120: 12 esterni non risolti
1>
1>Compilazione NON RIUSCITA.
1>
1>Tempo trascorso 00:00:00.81
========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========

Why I obtain "external link error" ?? 为什么我获得“外部链接错误”?

Please, help me...I don't know what to do... 拜托,帮帮我......我不知道该怎么办......

You need to correctly set the path to the 64-bit cvblobslib.lib. 您需要正确设置64位 cvblobslib.lib的路径。

Go to Project Settings, Configuration Properties and find the settings: 转到项目设置,配置属性并查找设置:

  • Linker -> General -> Additional Library Directories 链接器 - >常规 - >其他库目录
  • Linker -> Input -> Additional Dependencies 链接器 - >输入 - >附加依赖项

Although, this is easier if the cvblobslib project is in the same solution as prova64, in which case you can add a project reference (right click prova64 project, References..., add the cvblobslib project). 虽然,如果cvblobslib项目与prova64在同一解决方案中,这会更容易,在这种情况下,您可以添加项目引用(右键单击prova64项目,引用...,添加cvblobslib项目)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM