我有这个代码,当我编译时我有这个错误:
1>main1.obj : error LNK2019: unresolved external symbol _AsmSearchDll referenced in function _main
1>D:\Projects\C++\CascadeTrain\Debug\LicentaOpenCv2.4.4.exe : fatal error LNK1120: 1 unresolved externals
#include "stasm_dll.hpp"
int main (int argc, char** argv)
{
const char *image_name = "D:\\Projects\\C++\\CascadeTrain\\CascadeTrain\\Images\\12\\FirstWide\\frame1.jpg";
IplImage *img = cvLoadImage(image_name, CV_LOAD_IMAGE_COLOR);
if (img == NULL) {
printf("Error: Cannot open %s\n", image_name);
return -1;
}
// locate the facial landmarks with stasm
int nlandmarks;
int landmarks[500]; // space for x,y coords of up to 250 landmarks
AsmSearchDll(&nlandmarks, landmarks,
image_name, img->imageData, img->width, img->height,
1 , NULL , NULL );
if (nlandmarks == 0) {
printf("\nError: Cannot locate landmarks in %s\n", image_name);
return -1;
}
#if 0 // print the landmarks if you want
printf("landmarks:\n");
for (int i = 0; i < nlandmarks; i++)
printf("%3d: %4d %4d\n", i, landmarks[2 * i], landmarks[2 * i + 1]);
#endif
// draw the landmarks on the image
int *p = landmarks;
cvPolyLine(img, (CvPoint **)&p, &nlandmarks, 1, 1, CV_RGB(255,0,0));
// show the image with the landmarks
cvShowImage("stasm example", img);
cvWaitKey(0);
cvDestroyWindow("stasm example");
cvReleaseImage(&img);
return 0;
}
我在同一个目录中有 .cpp 和 .dll 。