Visual studio C++;zbar库-未解析的外部符号

Visual studio C++;zbar库-未解析的外部符号,visual-studio,qr-code,zbar,Visual Studio,Qr Code,Zbar,我运行了以下代码,使用zbar库获取条形码的代码特性,并为项目设置了属性。我收到了一些错误,例如未解决的外部符号错误(LNK2019)。如何解决此错误?我的程序代码和错误附在下面 #include <opencv2/opencv.hpp> #include <C:/Program Files/ZBar/include/zbar.h> using namespace cv; using namespace std; using nam

我运行了以下代码,使用zbar库获取条形码的代码特性,并为项目设置了属性。我收到了一些错误,例如未解决的外部符号错误(LNK2019)。如何解决此错误?我的程序代码和错误附在下面

    #include <opencv2/opencv.hpp>
    #include <C:/Program Files/ZBar/include/zbar.h>
    using namespace cv;
    using namespace std;
    using namespace zbar;
    typedef struct
    {
      string type;
      string data;
      vector <Point> location;
    } decodedObject;

    // Find and decode barcodes and QR codes
    void decode(Mat& im, vector<decodedObject>& decodedObjects)
    {

      // Create zbar scanner
      ImageScanner scanner;

      // Configure scanner
      scanner.set_config(ZBAR_NONE, ZBAR_CFG_ENABLE, 1);

      // Convert image to grayscale
      Mat imGray;
      cvtColor(im, imGray, COLOR_BGR2GRAY);

      // Wrap image data in a zbar image
     Image image(im.cols, im.rows, "Y800", (uchar*)imGray.data, im.cols * im.rows);

     // Scan the image for barcodes and QRCodes
     int n = scanner.scan(image);

     // Print results
     for (Image::SymbolIterator symbol = image.symbol_begin(); symbol != image.symbol_end(); ++symbol)
     {
        decodedObject obj;

        obj.type = symbol->get_type_name();
        obj.data = symbol->get_data();

        // Print type and data
        cout << "Type : " << obj.type << endl;`
        cout << "Data : " << obj.data << endl << endl;

        // Obtain location
        for (int i = 0; i < symbol->get_location_size(); i++)
        {
            obj.location.push_back(Point(symbol->get_location_x(i), symbol->get_location_y(i)));
        }

        decodedObjects.push_back(obj);
    }
}

// Display barcode and QR code location  
void display(Mat& im, vector<decodedObject>& decodedObjects)
{
    // Loop over all decoded objects
    for (int i = 0; i < decodedObjects.size(); i++)
    {
        vector<Point> points = decodedObjects[i].location;
        vector<Point> hull;

        // If the points do not form a quad, find convex hull
        if (points.size() > 4)
            convexHull(points, hull);
        else
            hull = points;

        // Number of points in the convex hull
        int n = hull.size();

        for (int j = 0; j < n; j++)
        {
            line(im, hull[j], hull[(j + 1) % n], Scalar(255, 0, 0), 3);
        }

    }

    // Display results 
    imshow("Results", im);
    waitKey(0);

}

int main(int argc, char* argv[])
{

    // Read image
    Mat im = imread("zbar-test.jpg");

    // Variable for decoded objects 
    vector<decodedObject> decodedObjects;

    // Find and decode barcodes and QR codes
    decode(im, decodedObjects);

    // Display location 
    display(im, decodedObjects);

    return EXIT_SUCCESS;
}
#包括
#包括
使用名称空间cv;
使用名称空间std;
使用名称空间zbar;
类型定义结构
{
字符串类型;
字符串数据;
矢量定位;
}解码对象;
//查找并解码条形码和二维码
无效解码(Mat和im、矢量和解码对象)
{
//创建zbar扫描仪
图像扫描仪;
//配置扫描仪
scanner.set_config(ZBAR_NONE,ZBAR_CFG_ENABLE,1);
//将图像转换为灰度
Mat imGray;
CVT颜色(浅灰色、浅灰色、浅灰色);
//将图像数据包装到zbar图像中
图像图像(im.cols,im.rows,“Y800”,(uchar*)imGray.data,im.cols*im.rows);
//扫描图像中的条形码和QR码
int n=扫描仪扫描(图像);
//打印结果
对于(Image::symbol畸胎体symbol=Image.symbol_begin();symbol!=Image.symbol_end();++symbol)
{
解码对象对象;
obj.type=symbol->get_type_name();
obj.data=symbol->get_data();
//打印类型和数据

无法请不要发布文本图像。相反,请将文本粘贴到代码块中。