Reputation: 292
today I've compiled "cvblobslib" for Windows with OpenCV in my Visual Studio C++ 2010.
Compilation goes OK, and I obtain "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:
"1 - open the project of the library and build it (OK, done) 2 - in the project where the library should be used, add:
2.1 In "Project/Settings/C++/Preprocessor/Additional Include directories" add the directory where the blob library is stored (done)
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?)
3- Include the file "BlobResult.h" where you want to use blob variables (OK, done)
NOTE: Verify that in the project where the cvblobslib.lib is used, the MFC Runtime Libraries are not mixed:
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...
Upvotes: 0
Views: 665
Reputation: 30579
You need to correctly set the path to the 64-bit cvblobslib.lib.
Go to Project Settings, Configuration Properties and find the settings:
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).
Upvotes: 2