0

I'm attempting to stitch together a set of images using OpenCV.

I found some example code from this source: https://www.youtube.com/watch?v=dCUkc0VmqtA, which I have also included below:

#include <iostream>
#include <fstream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/stitching/stitcher.hpp"

using namespace std;
using namespace cv;

bool try_use_gpu = false;
vector<Mat> imgs;
string result_name = "result.jpg";

void printUsage();
int parseCmdArgs(int argc, char** argv);

int main(int argc, char* argv[])
{
    int retval = parseCmdArgs(argc, argv);
    if (retval) return -1;

    Mat pano;
    Stitcher stitcher = Stitcher::createDefault(try_use_gpu);
    Stitcher::Status status = stitcher.stitch(imgs, pano);

    if (status != Stitcher::OK)
    {
        cout << "Can't stitch images, error code = " << status << endl;
        return -1;
    }

    imwrite(result_name, pano);
    return 0;
}

However, when I try to build the above code, I recieve the following error message:

1>main.obj : error LNK2019: unresolved external symbol "int __cdecl parseCmdArgs(int,char * *)" (?parseCmdArgs@@YAHHPAPAD@Z) referenced in function _main

Would anyone be able to explain why this happens, and how to solve the problem?

Note: I am using OpenCV 2.4.10 and Microsoft Visual Studio 2010.

  • you're missing a .lib file that you need to link to the project. you must specify to msvc that you want to use that library, and enable it to find the file. – Boyko Perfanov May 11 '15 at 10:43
  • Hi Boyko, thank you for your response. Would you happen to know which .lib file MSVC is asking for? –  May 11 '15 at 10:55
  • Probably the one which contains the function you forward-declared `int parseCmdArgs(int argc, char** argv);` – Boyko Perfanov May 11 '15 at 10:58

0 Answers0