OpenCV不能与VS2013一起使用 [英] OpenCV doesn't work with VS2013

查看:720
本文介绍了OpenCV不能与VS2013一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了openCV ver。 3.00 beta在我的电脑上,我试图用VS2013测试。我也跟着快速入门指南:

I just installed openCV ver. 3.00 beta on my computer and I'm trying to test it with VS2013. I followed quick start guide:

1)的安装Windows ,使用预构建库。

1) Installation for windows, using pre-build libraries.

2)微软VS 里面的OpenCV,使用本地方法和 x64 / vc12 库。

2) OpenCV inside Microsoft VS, using local method and x64/vc12 directory for libraries.

结果,他们的例子/ p>

As a result, their example(listed in link #2) produced an error:

#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
    if (argc != 2)
    {
        cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
        return -1;
    }

    Mat image;
    image = imread(argv[1], IMREAD_COLOR); // Read the file

    if (image.empty()) // Check for invalid input
    {
        cout << "Could not open or find the image" << std::endl;
        return -1;
    }

    namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
    imshow("Display window", image); // Show our image inside it.

    waitKey(0); // Wait for a keystroke in the window
    return 0;
}

输出为:

1>------ Build started: Project: test_openCV, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'opencv_calib3d300d.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



根据我的理解,我的程序可以看到openCV库,但由于某种原因不能打开它们。请帮助。

As far as I understand, my program can see openCV libraries, but for some reason cannot open them. Please help.

感谢

更新:尝试做前四条建议, 。所以我将在这里发布完整的信息:

Update: Tried to do what was recommended in first four comments, no result still. So I will post here full information:

项目:CUDA 6.5(我需要与CUDA合作)。

Project: CUDA 6.5 (I need to work with CUDA).

源文件: Source.cpp

模式:调试,x64。

环境变量:

OPENCV_DIR: C:\programs\misha\opencv\build\x64\vc12

Path (the last string): %OPENCV_DIR%\bin

网页属性:

C\C++ -> General -> Additional Include Directories(last string):
    $(OPENCV_DIR)\..\..\include
Linker -> General -> Additional Library Directories(last string):
    $(OPENCV_DIR)\lib
Linker -> Input -> Additional Dependencies:
    opencv_calib3d300d.lib
    opencv_core300d.lib
    opencv_features2d300d.lib
    opencv_flann300d.lib
    opencv_highgui300d.lib
    opencv_imgcodecs300d.lib
    opencv_imgproc300d.lib
    opencv_ml300d.lib
    opencv_objdetect300d.lib
    opencv_photo300d.lib
    opencv_shape300d.lib
    opencv_stitching300d.lib
    opencv_superres300d.lib
    opencv_ts300d.lib
    opencv_video300d.lib
    opencv_videoio300d.lib
    opencv_videostab300d.lib

输出:

1>------ Build started: Project: test_openCV, Configuration: Debug x64 ------
1>LINK : fatal error LNK1104: cannot open file 'opencv_calib3d300d.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

因此,我无法构建x64项目有些原因。错误是一样的。

So, I cannot build x64 project for some reason. Error is the same.

更新2:如果你能建立这个例子中(或OpenCV的任何例子),可以请你给它Genkin将@物理学。 msu.ru?我会弄清楚我自己

推荐答案

在不同的尝试很长一段时间,我找到了答案<一个href =http://stackoverflow.com/questions/27491041/opencv-unresolved-external-symbol>这里。对于 x64 项目,除了我上面做的,你必须:

After a long time of different attempts, I found the answer here. For x64 project, in addition to what I did above, you have to:

1)设置环境变量。没有更新我的电脑上变量PATH没有重新启动。

1) Restart your PC after setting enviromental variables. Variable Path was not updated on my computer without restart.

2)除了上面添加库,你必须添加(虽然,在这个例子有些人可能不可以使用):

2) In addition to libraries added above, you have to add (although, for this example some of them might not be used):

ippicvmt.lib
IlmImfd.lib
libtiffd.lib 
libpngd.lib
libjasperd.lib
libjpegd.lib
libwebpd.lib
zlibd.lib
comctl32.lib

编辑:我最近不得不重新安装在一台新的电脑上。正如user1060873指出的,您只需要添加位于$ OPENCV $ / lib文件夹中的库。例如,在我的电脑上,它是 C:\opencv\build\x64\vc12\lib 。注意,对于调试模式,您应该添加 opencv_world310d.lib ,并为发布 opencv_world310.lib

I recently had to install it again on a new PC. As user1060873 pointed out, you have to add only the libraries located in your $OPENCV$/lib folder. For example, on my PC it is C:\opencv\build\x64\vc12\lib. Note, that for debug mode you should add opencv_world310d.lib, and for release opencv_world310.lib

这篇关于OpenCV不能与VS2013一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆