Tutorial: Scanning Barcodes / QR Codes with OpenCV using ZBar

Categories Computer Vision, Uncategorized
With the ZBar library, scanning Barcodes / QR codes is quite simple. ZBar is able to identify multiple bar code /qr code types and able to give the coords of their locations.

This tutorial was written using:
Microsoft Visual Studio 2008 Express
OpenCV 2.4.2
Windows Vista 32-bit
ZBar 0.1

You will need OpenCV installed before doing this tutorial

Tutorial here: http://ayoungprogrammer.blogspot.ca/2012/10/tutorial-install-opencv-242-for-windows.html

1. Install ZBar (Windows Installer)

http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10-setup.exe/download

Check install developmental libraries and headers (You will need this)

Install ZBar in the default directory
“C:Program FilesZBar”

2. Import headers and libraries

Tools ->Options 

Projects & Solutions -> VC++ Directories
Go to “Include files” and add: “C:Program FilesZBarinclude”

 Go to “Library files and add: “C:Program FilesZBarlib”

3. Link libraries in current project

Create an empy blank console project
Right click your project -> Properties -> Configuration Properties -> Linker -> Input

In additional dependencies copy and paste the following:
libzbar-0.lib
opencv_core242d.lib
opencv_imgproc242d.lib
opencv_highgui242d.lib
opencv_ml242d.lib
opencv_video242d.lib
opencv_features2d242d.lib
opencv_calib3d242d.lib
opencv_objdetect242d.lib
opencv_contrib242d.lib
opencv_legacy242d.lib
opencv_flann242d.lib

4. Test Program

Make a new file in your project: main.cpp
 #include "zbar.h"  
 #include "cv.h"  
 #include "highgui.h"  
 #include <iostream>  
 using namespace std;  
 using namespace zbar;  
 using namespace cv;  
 int main(void){  
      ImageScanner scanner;  
      scanner.set_config(ZBAR_NONE, ZBAR_CFG_ENABLE, 1);  
       // obtain image data  
      char file[256];  
      cin>>file;  
      Mat img = imread(file,0);  
      Mat imgout;  
      cvtColor(img,imgout,CV_GRAY2RGB);  
      int width = img.cols;  
      int height = img.rows;  
   uchar *raw = (uchar *)img.data;  
   // wrap image data  
   Image image(width, height, "Y800", raw, width * height);  
   // scan the image for barcodes  
   int n = scanner.scan(image);  
   // extract results  
   for(Image::SymbolIterator symbol = image.symbol_begin();  
     symbol != image.symbol_end();  
     ++symbol) {  
                vector<Point> vp;  
     // do something useful with results  
     cout << "decoded " << symbol->get_type_name()  
        << " symbol "" << symbol->get_data() << '"' <<" "<< endl;  
           int n = symbol->get_location_size();  
           for(int i=0;i<n;i++){  
                vp.push_back(Point(symbol->get_location_x(i),symbol->get_location_y(i))); 
           }  
           RotatedRect r = minAreaRect(vp);  
           Point2f pts[4];  
           r.points(pts);  
           for(int i=0;i<4;i++){  
                line(imgout,pts[i],pts[(i+1)%4],Scalar(255,0,0),3);  
           }  
           cout<<"Angle: "<<r.angle<<endl;  
   }  
      imshow("imgout.jpg",imgout);  
   // clean up  
   image.set_data(NULL, 0);  
       waitKey();  
 }  

5. Copy libzbar-0.dll from C:/Program Files/ZBar/bin to your project folder

6. Run program 

Sample Images

53 Comments

  • antonio genovese
    October 24, 2013

    hi, can you help me with Zbar-opencv-language c?
    i have this error:
    error C2065: 'scanner' : undeclared identifier
    error C3861: 'zbar_image_scanner_create': identifier not found
    error C2065: 'scanner' : undeclared identifier c:documents and settingsadministratordesktopzbar_opencvdisparitymain.cpp 73
    error C2065: 'ZBAR_CFG_ENABLE' : undeclared identifier c:documents and settingsadministratordesktopzbar_opencvdisparitymain.cpp 73
    error C3861: 'zbar_image_destroy': identifier not found

    I use Visual studio 2008 and OpenCV 2.4.6. The code is:

    #include
    #include
    #include

    int main (int argc, char **argv)
    {
    if(argc < 2) return(1);

    /* create a reader */
    scanner = zbar_image_scanner_create();

    /* configure the reader */
    zbar_image_scanner_set_config(scanner, 0, ZBAR_CFG_ENABLE, 1);

    /* obtain image data */
    int width = 0, height = 0;
    void *raw = NULL;
    get_data(argv[1], &width, &height, &raw);

    /* wrap image data */
    zbar_image_t *image = zbar_image_create();
    zbar_image_set_format(image, *(int*)"Y800");
    zbar_image_set_size(image, width, height);
    zbar_image_set_data(image, raw, width * height, zbar_image_free_data);

    /* scan the image for barcodes */
    int n = zbar_scan_image(scanner, image);

    /* extract results */
    const zbar_symbol_t *symbol = zbar_image_first_symbol(image);
    for(; symbol; symbol = zbar_symbol_next(symbol)) {
    /* do something useful with results */
    zbar_symbol_type_t typ = zbar_symbol_get_type(symbol);
    const char *data = zbar_symbol_get_data(symbol);
    printf("decoded %s symbol "%s"n",
    zbar_get_symbol_name(typ), data);
    }

    /* clean up */
    zbar_image_destroy(image);

    return(0);
    }

    thanks for you help!.

    • Alex
      July 4, 2016

      when you compiles, did you aggregate library -lzbar ?

  • ayoungprogrammer
    October 25, 2013

    Your #include header files are blank.
    Change the blank #includes to:
    #include "zbar.h"
    #include "cv.h"
    #include "highgui.h"
    #include

    • Oppir
      January 22, 2017

      Hy.. i’m oppir. I have try your source code belong, but the library zbar doesn’t know. Still error’. How can I silver the problem..? Please.
      Thank you

      • Oppir
        January 22, 2017

        I mean solve the problem

  • antonio genovese
    October 25, 2013

    thanks for your response.
    in visual studio there. I did not realize that here were not there.

  • antonio genovese
    October 26, 2013

    I have also tried to run your source code, but when I run my reports the following error:
    i write: test1.png—>enter

    OpenCV Error: Assertion failed (Size.Width> 0 && Size.Height> 0) in unknown function, file .. .. .. src opencv modules highgui src windows.cpp, line 261.

    in a window appears:
    Microsoft exception at 0x7c812afb in "NOMEMYFILE." Exe:
    Microsoft C + + exception: cv :: Exception at memory location 0x0011f869.

    But when I compile your source code there are no errors:
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

    • ayoungprogrammer
      October 26, 2013

      Your image is probably invalid as you have the assertion error to invalid dimensions.

  • antonio genovese
    October 26, 2013

    The errors is generated:

    Mat img = imread("test2.jpg");
    /* load the image */
    Mat imgout;
    cvtColor(img,imgout,CV_GRAY2RGB);
    int width = img.cols;
    int height = img.rows;
    uchar *raw = (uchar *)img.data;

    L 'error is generated by the fact that cols, rows and date are zero.
    But I do not understand why.
    The image is downloaded of your page.

  • antonio genovese
    October 26, 2013

    The resutls of debug are:

    CV_GRAY2RGB 8 int
    – img {flags=1124007936 dims=0 rows=0 …} cv::Mat
    flags 1124007936 int
    dims 0 int
    rows 0 int
    cols 0 int
    + data 0x00000000 unsigned char *
    + refcount 0x00000000 int *
    + datastart 0x00000000 unsigned char *
    + dataend 0x00000000 unsigned char *
    + datalimit 0x00000000 unsigned char *
    + allocator 0x00000000 cv::MatAllocator *
    + size {p=0x0012ff08 } cv::Mat::MSize
    + step {p=0x0012ff30 buf=0x0012ff30 } cv::Mat::MStep
    – imgout {flags=1124007936 dims=0 rows=0 …} cv::Mat
    flags 1124007936 int
    dims 0 int
    rows 0 int
    cols 0 int
    + data 0x00000000 unsigned char *
    + refcount 0x00000000 int *
    + datastart 0x00000000 unsigned char *
    + dataend 0x00000000 unsigned char *
    + datalimit 0x00000000 unsigned char *
    + allocator 0x00000000 cv::MatAllocator *
    + size {p=0x0012fec8 } cv::Mat::MSize
    + step {p=0x0012fef0 buf=0x0012fef0 } cv::Mat::MStep

  • Mastery Chip
    November 19, 2013

    can pls you tell me the supported hardware scanners

    Thanx in advance

  • Rayson NaNo
    December 4, 2013

    Hi . Thanks For Code.
    my Code When build and start is succes . but Error when i want Enter my Picture name .
    Message Error Is :
    Unhandled exception at 0x75cf9617 in ImgProTest.exe: Microsoft C++ exception: cv::Exception at memory location 0x0011f180..

  • vallet alexis
    February 11, 2014

    Hi,
    Great code to begin with barcode scanning, it was able to adapt it for linux g++ without much troubles,so thank you for that !

    • Chris Hartle
      September 1, 2014

      Hello, do you mind expanding a little on how you built zbar for linux? I'm looking in to using QR recognition using a Beaglebone Black running debian.

      Thanks!

  • Steven
    March 4, 2014

    Hi Michael,

    I'm trying to use zbar and openCV for a school project but everytime I try to run the code in visual studios 2010 it gives me the error that libiconv-2.dll is missing. Any help is GREATLY appreciated!

    Thanks,
    Steven

  • bilow
    April 1, 2014

    Hi,
    I've got your code working very easy and it's working fine. But I'd like to start using this with live (web)camera feed. Do you have an tutorial / example for this where you use an (web)camera?? Would bu super if this could be done in realtime! Thanks for your help

    • ayoungprogrammer
      April 1, 2014

      I'll try something out!

  • bilow
    April 1, 2014

    P.s.
    I've tried to scan a video stream frame by frame, but I keep getting errors and unhandled exceptions.

  • navya
    June 2, 2014

    Hi Michael,

    I'm trying to use zbar and openCV but everytime I try to run the code in visual studios 2008 it gives me the error that libiconv-2.dll is missing.
    i tried to install it from http://gnuwin32.sourceforge.net/downlinks/libiconv-bin-zip.php but it is showing the same error……
    any help would be greatly appreciated….
    thanks,
    navya

    Thanks,
    Steven

    • ayoungprogrammer
      June 3, 2014

      Download the dll and extract it to the folder your project is in

    • navya
      June 3, 2014

      its working fine now.. thanks…. but now another problem has risen…. when i run it it says…..

      Unhandled exception at 0x771cc42d in yoyo.exe: Microsoft C++ exception: cv::Exception at memory location 0x0031e834..

      what is the problem that is happening?
      how to fix it?

    • ayoungprogrammer
      June 3, 2014

      I've seen this error occur many times when the image file is invalid or I have the wrong path. Please make sure you image path is correct

    • navya
      June 3, 2014

      ok.. thank you… 🙂
      can we find the position also of the QR tag in a file?

    • ayoungprogrammer
      June 4, 2014

      Yes I believe you can! Take a look at this:

      http://blog.ayoungprogrammer.com/2014/04/real-time-qr-code-bar-code-detection.html

    • navya
      June 4, 2014

      how can we make the code work if the qr text is at a slant surface?

    • ayoungprogrammer
      June 4, 2014

      I'm not sure what you mean. Can you post a picture?

  • navya
    June 18, 2014

    ya.. dis is the url for the picture: http://imageshack.com/a/img820/9430/8n71.png
    and fr dis image it is showing a memory exception : http://imageshack.com/a/img853/2686/l7e9.png

    • ayoungprogrammer
      June 18, 2014

      Judging from the picture you sent me, you may need a better webcam or hold the bar code closer or print bigger bar codes

  • Ninad
    June 30, 2014

    Thanks for the tutorial! I tried it out and was able to get the code to compile and run after copy libiconv-2.dll from the ZBar bin folder to my program folder. However, the code does not find any barcodes in the sample images you provided above. I have not made any changes to your example code and hence am not sure what's going on. Any ideas?

    • just2garfield
      March 28, 2015

      Hi! Did you solve the problem? I tried running the code yesterday, it compiles just fine, but it doesn't find any bar code/qr code in my images. Not even in the sample ones.
      I tried playing a bit with the scanner.set_config parameters but nothing seems to work. I am also using opencv 244. Thanks!

    • ayoungprogrammer
      March 28, 2015

      That is very strange…did you copy the code wrong? What version of zbar are you using?

      • Aamod
        July 6, 2016

        Hello ‘ayoungprogrammer’,
        Thanks for porting the code from ImageMagick to Opencv. However, even I am having the same issue as mentioned by ‘Ninad’ and ‘just2garfield’ above. My program compiles and runs good, but it does not detect any data/barcode from the sample image (barcode.png). I am using Visual Studio 2010, Opencv 2.4.13, zbar 0.10. Any help is appreciated. 🙂

        • Aamod
          July 6, 2016

          Hey, I resolved the issue just now.
          While reading the image, instead of reading it as a colored image and then using cvtColor() to convert to grayscale, I directly read the image as Grayscale and simply use it ahead. It is now able to detect the barcodes. 🙂

          Mat image = imread(file, CV_LOAD_IMAGE_GRAYSCALE);

  • Lahiru S Ranasinghe
    November 16, 2014

    Hi i'm using opencv 248 visual studio 2010 C++. Can i still use this Zbar library and the code?

    • ayoungprogrammer
      November 16, 2014

      Yes you can still use it

  • jacob lee
    November 18, 2014

    The code from the sample is using images stored on the computer. I'm trying to loop trough the code frame by frame as you said yes (got the code from the openCV samples), but I'm getting this error:

    Unhandled exception at 0x770E4B32 in ConsoleApplicationCV.exe: Microsoft C++ exception: cv::Exception at memory location 0x002FB3F4.

    If you'd take the sample given above (see link), what would be the correct way to loop it then??

    By the way,you are excellent. Your tutorial about scanning barcodes / QR Codes with openCV using ZBar is in very details.Your article is written very well, there is a lot of very useful knowledge to help me solve problems.I enjoy reading your article and hope to see more.

    Tagged with: Programmer Barcode Generator Scanning Barcodes / QR Codes OpenCV ZBar

    :

    • ayoungprogrammer
      November 18, 2014

      Thank you for your feedback!

      Sorry I don't understand your question, what do you mean the correct way to loop it?

  • Cağrı Candan
    January 23, 2015

    hi firstly thanks for this ;
    i have a problem when i compile program ı recive an error which is libzar-0.dll is missing from your computer .
    could you offer me a solution about that thaks ?

  • Piotr Jankowski
    February 7, 2016

    where can I find the version 2.4.2 ? I use version 2.4.11 but jump out errors. http://imageshack.com/a/img923/9356/n0MuEq.png

  • Fred Castillo
    April 9, 2016

    This was a big help, thank you! 🙂

    Fred | Barcode Wire

  • 利军
    May 13, 2016

    hello,i want to know the speed of the Zbar to decode the QR code,if the QR is 1m/s ,can it decode it?

  • Unknown
    May 21, 2016

    Hi,
    I am using x64
    and getting the below errors:

    test.obj : error LNK2019: unresolved external symbol zbar_image_set_size referenced in function "public: void __cdecl zbar::Image::set_size(unsigned int,unsigned int)" ([email protected]@[email protected]@[email protected])
    test.obj : error LNK2019: unresolved external symbol zbar_image_set_data referenced in function "public: void __cdecl zbar::Image::set_data(void const *,unsigned long)" ([email protected]@[email protected]@[email protected])
    test.obj : error LNK2019: unresolved external symbol zbar_image_set_userdata referenced in function "public: __cdecl zbar::Image::Image(unsigned int,unsigned int,class std::basic_string,class std::allocator > const &,void const *,unsigned long)" ([email protected]@@[email protected][email protected]?$char_traits[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected])
    test.obj : error LNK2019: unresolved external symbol zbar_image_get_userdata referenced in function "protected: static void __cdecl zbar::Image::_cleanup(struct zbar::zbar_image_s *)" ([email protected]@[email protected]@[email protected]@@Z)
    test.obj : error LNK2019: unresolved external symbol zbar_image_scanner_create referenced in function "public: __cdecl zbar::ImageScanner::ImageScanner(struct zbar::zbar_image_scanner_s *)" ([email protected]@@[email protected][email protected]@@Z)
    test.obj : error LNK2019: unresolved external symbol zbar_image_scanner_destroy referenced in function "public: __cdecl zbar::ImageScanner::~ImageScanner(void)" ([email protected]@@[email protected])
    test.obj : error LNK2019: unresolved external symbol zbar_image_scanner_set_config referenced in function "public: int __cdecl zbar::ImageScanner::set_config(enum zbar::zbar_symbol_type_e,enum zbar::zbar_config_e,int)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected])
    test.obj : error LNK2019: unresolved external symbol zbar_scan_image referenced in function "public: int __cdecl zbar::ImageScanner::scan(class zbar::Image &)" ([email protected]@[email protected]@[email protected]@@Z)
    c:users****documentsvisual studio 2015ProjectsOPENCVTest2x64DebugOPENCVTest2.exe : fatal error LNK1120: 24 unresolved externals

    • ayoungprogrammer
      May 21, 2016

      It looks like you didn't link your libraries properly in step 3. If you're using the new visual studios 2012+ you will have to look up the new way to do this. I may update this blogpost in the future.

    • Unknown
      May 31, 2016

      Have you figured out a solution? I am having the same problem. I added Zbarinclude to additional include directories, ZBarlib to additional library directories, libzbar-0.lib to additional dependencies, still getting unresolved externals.

    • Lana Bork
      June 1, 2016

      So if anyone else has this problem: You should download zbar for win64. Just google it, someone has already fixed it. Then you just need to follow the steps listed here making sure that library you add is called libzbar64-0.lib.

  • Raj Kumar Mishra
    September 12, 2016

    When I am using the above mentioned code for testing, following errors arises

    1>—— Build started: Project: FirstProject, Configuration: Debug x64 ——
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_get_symbol_name referenced in function “public: class std::basic_string<char,struct std::char_traits,class std::allocator > const __cdecl zbar::Symbol::get_type_name(void)const ” ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@XZ)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol _zbar_error_string referenced in function “public: virtual char const * __cdecl zbar::Exception::what(void)const ” ([email protected]@[email protected]@UEBAPEBDXZ)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_symbol_ref referenced in function “public: void __cdecl zbar::Symbol::ref(int)const ” ([email protected]@[email protected]@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_symbol_get_type referenced in function “protected: void __cdecl zbar::Symbol::init(struct zbar::zbar_symbol_s const *)” ([email protected]@[email protected]@[email protected]@@Z)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_symbol_get_data referenced in function “protected: void __cdecl zbar::Symbol::init(struct zbar::zbar_symbol_s const *)” ([email protected]@[email protected]@[email protected]@@Z)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_symbol_get_data_length referenced in function “protected: void __cdecl zbar::Symbol::init(struct zbar::zbar_symbol_s const *)” ([email protected]@[email protected]@[email protected]@@Z)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_symbol_get_loc_size referenced in function “public: int __cdecl zbar::Symbol::get_location_size(void)const ” ([email protected]@[email protected]@QEBAHXZ)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_symbol_get_loc_x referenced in function “public: int __cdecl zbar::Symbol::get_location_x(unsigned int)const ” ([email protected]@[email protected]@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_symbol_get_loc_y referenced in function “public: int __cdecl zbar::Symbol::get_location_y(unsigned int)const ” ([email protected]@[email protected]@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_symbol_next referenced in function “public: class zbar::SymbolIterator & __cdecl zbar::SymbolIterator::operator++(void)” ([email protected]@@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_symbol_set_ref referenced in function “public: void __cdecl zbar::SymbolSet::ref(int)const ” ([email protected]@[email protected]@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_symbol_set_first_symbol referenced in function “public: __cdecl zbar::SymbolIterator::SymbolIterator(class zbar::SymbolSet const &)” ([email protected]@@[email protected]@[email protected]@Z)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_create referenced in function “public: __cdecl zbar::Image::Image(unsigned int,unsigned int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,void const *,unsigned long)” ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_ref referenced in function “public: __cdecl zbar::Image::~Image(void)” ([email protected]@@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_get_symbols referenced in function “public: class zbar::SymbolSet const __cdecl zbar::Image::get_symbols(void)const ” ([email protected]@[email protected]@[email protected]@XZ)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_set_format referenced in function “public: void __cdecl zbar::Image::set_format(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)” ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_set_size referenced in function “public: void __cdecl zbar::Image::set_size(unsigned int,unsigned int)” ([email protected]@[email protected]@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_set_data referenced in function “public: void __cdecl zbar::Image::set_data(void const *,unsigned long)” ([email protected]@[email protected]@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_set_userdata referenced in function “public: __cdecl zbar::Image::Image(unsigned int,unsigned int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,void const *,unsigned long)” ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_get_userdata referenced in function “protected: static void __cdecl zbar::Image::_cleanup(struct zbar::zbar_image_s *)” ([email protected][email protected]@@[email protected]@@Z)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_scanner_create referenced in function “public: __cdecl zbar::ImageScanner::ImageScanner(struct zbar::zbar_image_scanner_s *)” ([email protected]@@[email protected][email protected]@@Z)
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_scanner_destroy referenced in function “public: __cdecl zbar::ImageScanner::~ImageScanner(void)” ([email protected]@@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_image_scanner_set_config referenced in function “public: int __cdecl zbar::ImageScanner::set_config(enum zbar::zbar_symbol_type_e,enum zbar::zbar_config_e,int)” ([email protected]@[email protected]@[email protected]@[email protected]@[email protected])
    1>Barcode_Testing.obj : error LNK2019: unresolved external symbol zbar_scan_image referenced in function “public: int __cdecl zbar::ImageScanner::scan(class zbar::Image &)” ([email protected]@[email protected]@[email protected]@@Z)
    1>C:\Users\hp pc\Documents\Visual Studio 2012\Projects\FirstProject – Copy\FirstProject\x64\Debug\FirstProject.exe : fatal error LNK1120: 24 unresolved externals
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    I have followed all the steps as mentioned. I am using Visual Studio 2012 Ultimate and a C/C++ Project. I already have OpenCV configured for this project.
    Kindly help me.
    Thank You.

    • ayoungprogrammer
      September 12, 2016

      Hi Raj,

      It looks like you need to link the zbar libraries as mentioned in step 3. If that doesn’t work, there is a comment above that may have a solution:

      “So if anyone else has this problem: You should download zbar for win64. Just google it, someone has already fixed it. Then you just need to follow the steps listed here making sure that library you add is called libzbar64-0.lib.”

  • Johnny
    April 11, 2017

    Did anyone solve the problem LNK2019? I cannot find zbar win64

  • koukou
    April 20, 2017

    Hello i have a problem at the level> zbar.h> is what you can help me .meme i install zbar and opencv
    Thank you for answering me

  • Jonas
    April 25, 2017

    Could you please update the torturial so that it works with the newer versions of Visual Studio – That would be so great!
    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *