エラーLNK2001とLNK1120のエラーが消えなくて困っています
Posted: 2016年12月06日(火) 14:04
まず環境はVisualstudio2013でC++のWin10を使用しています。
下記のアンプルプログラムを動かしたいのですが、エラーLNK2001とLNK1120のエラーがでて動きません。プログラム初心者なのでわかる方いれば教えてほしいです。
#include <iostream>
#include <opencv2/opencv.hpp>
#include "lsd.h"
cv::Mat img;
int n_lines;
double* lines;
void change_th_lsd(int nfa, void* dummy)
{
cv::Mat result = img.clone();
for (int i = 0; i < n_lines; i++)
{
const double *line = &lines[i * 7];
if (nfa < line[6])
{
const cv::Point p1(line[0], line[1]);
const cv::Point p2(line[2], line[3]);
cv::line(result, p1, p2, cv::Scalar(0, 0, 255));
}
}
cv::imshow("result_image", result);
}
int main(int argc, char *argv[])
{
//画像をグレースケールとして読み込み
img = cv::imread(argv[1], 0);
//LSD用画像に変換><
double *dat = new double[img.rows * img.cols];
for (int y = 0; y < img.rows; y++)
for (int x = 0; x < img.cols; x++)
dat[y * img.cols + x] = img.at<unsigned char>(y, x);
//LSD処理
lines = lsd(&n_lines, dat, img.cols, img.rows);
//しきい値の最大値と最小値をもってくる
int max_NFA = 0;
for (int i = 0; i < n_lines; i++)
max_NFA = std::max(max_NFA, static_cast<int>(lines[i * 7 + 6]));
//結果描画用画像
cv::cvtColor(img, img, CV_GRAY2RGB);
//結果表示用ウィンドウ
cv::namedWindow("result_image");
cv::createTrackbar("NFA", "result_image", NULL, max_NFA, change_th_lsd);
cv::setTrackbarPos("NFA", "result_image", max_NFA);
//結果表示
cv::imshow("result_image", img);
cv::waitKey(0);
}
エラー内容は、
①error LNK2001: 外部シンボル ""double * __cdecl lsd(int *,double *,int,int)" (?lsd@@YAPEANPEAHPEANHH@Z)" は未解決です。
②error LNK1120: 1 件の未解決の外部参照
この二つです。
参考にしたサイトです。http://daily.belltail.jp/?p=1153
お願いします。
下記のアンプルプログラムを動かしたいのですが、エラーLNK2001とLNK1120のエラーがでて動きません。プログラム初心者なのでわかる方いれば教えてほしいです。
#include <iostream>
#include <opencv2/opencv.hpp>
#include "lsd.h"
cv::Mat img;
int n_lines;
double* lines;
void change_th_lsd(int nfa, void* dummy)
{
cv::Mat result = img.clone();
for (int i = 0; i < n_lines; i++)
{
const double *line = &lines[i * 7];
if (nfa < line[6])
{
const cv::Point p1(line[0], line[1]);
const cv::Point p2(line[2], line[3]);
cv::line(result, p1, p2, cv::Scalar(0, 0, 255));
}
}
cv::imshow("result_image", result);
}
int main(int argc, char *argv[])
{
//画像をグレースケールとして読み込み
img = cv::imread(argv[1], 0);
//LSD用画像に変換><
double *dat = new double[img.rows * img.cols];
for (int y = 0; y < img.rows; y++)
for (int x = 0; x < img.cols; x++)
dat[y * img.cols + x] = img.at<unsigned char>(y, x);
//LSD処理
lines = lsd(&n_lines, dat, img.cols, img.rows);
//しきい値の最大値と最小値をもってくる
int max_NFA = 0;
for (int i = 0; i < n_lines; i++)
max_NFA = std::max(max_NFA, static_cast<int>(lines[i * 7 + 6]));
//結果描画用画像
cv::cvtColor(img, img, CV_GRAY2RGB);
//結果表示用ウィンドウ
cv::namedWindow("result_image");
cv::createTrackbar("NFA", "result_image", NULL, max_NFA, change_th_lsd);
cv::setTrackbarPos("NFA", "result_image", max_NFA);
//結果表示
cv::imshow("result_image", img);
cv::waitKey(0);
}
エラー内容は、
①error LNK2001: 外部シンボル ""double * __cdecl lsd(int *,double *,int,int)" (?lsd@@YAPEANPEAHPEANHH@Z)" は未解決です。
②error LNK1120: 1 件の未解決の外部参照
この二つです。
参考にしたサイトです。http://daily.belltail.jp/?p=1153
お願いします。