English 中文(简体)
如何解决链接错误 我的视像C++2008年,开放世界。
原标题:how can i solve the link error My visual C++ 2008 with OpenCV?
  • 时间:2011-10-07 07:42:30
  •  标签:
  • c++
  • opencv

我是开放世界大事。

我刚刚安装了开放式电脑,使C++方案成为下文。

我的编辑是视觉C++。

# include "highgui.h"
void main() {
  IplImage* img = cvLoadImage("C:/OpenCV/samples/cpp/tutorial_code/images/lena.png",-1);
  cvNamedWindow("lena",0);
  cvShowImage("lena",image);
  cvWaitKey(0);
  cvReleaseImage(&image);
}

但这不能用错误的信息来加以构建,我无法解决这一问题。

错误信息如下。

(My compiler is Korean Version and I translate the error message into English. And the English is poor, but you may understand how it was processed.)

1>------ begin build: project: image1st,: Debug Win32 ------ 
1> compiling)
1>image1st.cpp
1>c:vs2008ccp_fileimage1stimage1st.cpp(17) : warning C4700: not inetialized ‘image’ use local variable
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>linking
1>image1st.obj : error LNK2019: _cvReleaseImage External Symbol(refrence positon: _main function) not defined.
1> image1st.obj : error LNK2019: _cvWaitKey External Symbol(refrence positon: _main function)not defined.
1> image1st.obj : error LNK2019: _cvShowImage External Symbol(refrence positon: _main function)not defined.)
1> image1st.obj : error LNK2019: _cvNamedWindow External Symbol(refrence positon: _main function)not defined.)
1>image1st.obj : error LNK2019: _cvLoadImage External Symbol(refrence positon: _main function)not defined.)
1>project: warning PRJ0018 : can not find the next environment variable.
1>$(OPENCV_DIR)
1>image1st – errors: 6, warning: 1

我修改了视像仪++环境如下。

在“包括名录”条目中,我投入了“(OPENCV_DIR)”。

and make the “Additional Dependencies” entry to include the next .lib file as the OpenCV Tutorials Release 2.3 guides.

  • ‘opencv_core231d.lib’
  • ‘opencv__imgproc231d.lib’
  • ‘opencv__highgui231d.lib’
  • ‘opencv__ml231d.lib’
  • ‘opencv__video231d.lib’
  • ‘opencv__features2d231d.lib’
  • ‘opencv__calib3d231d.lib’
  • ‘opencv__objdetect231d.lib’
  • ‘opencv__contrib231d.lib’
  • ‘opencv__legacy231d.lib’
  • ‘opencv__flann231d.lib’

视像仪++环境的图书馆名录也作如下修改。

图书馆:

  • $(VSInstallDir)lib
  • $(VSInstallDir)
  • $(FrameworkSDKDir)lib
  • $(WindowsSdkDir)lib
  • $(VCInstallDir)atlmfclibi386
  • $(VCInstallDir)atlmfclib
  • $(VCInstallDir)lib
  • C:opencvuildx86vc10lib // modified
  • C:opencvuildx86vc9lib // modified
  • C:opencvuildx64vc10lib // modified
  • C:opencvuildx64vc9lib // modified
  • C:opencvuildgpux86lib // modified
  • C:opencvuildgpux64lib // modified

包括:

  • $(VCInstallDir)atlmfcinclude
  • $(WindowsSdkDir)include
  • $(FrameworkSDKDir)include
  • $(VCInstallDir)include
  • C:OpenCVuildincludeopencv // modified
  • C:OpenCVuildincludeopencv2 // modified
  • C:opencvuildinclude // modified
问题回答

It s seems that your processor can t recognize the user vairble OPEN_CV first, make sure that the systemuser vairble is correct. in order to do that go to system properties --> on advance menu --> to go Enviroment variables --> make sure your system variable is correct , if not please create one with the path to your open cv library location.

“用户变量”/

it s seems like you are doing everything right , I believe your problem is that you have missed some at the post build step ...

Second , you ll have to copy the dll files from the openCV library to the location of your project. in order to do so , please include an appropriate path on the post build step on your project. go to your project : properties ... watch the picture here

包括指挥:

copy "C:OpenCV2.31CMake_BuildinDebug*.dll"
copy "C:OpenCV2.31CMake_BuildinDebug*.pdb"

uck

SOS

Basically it seems, that the compiler cannot find the OpenCV libraries or has trouble identifying the right one.

确保所需图书馆(即<条码>开放cv__xxx.lib) 可在图书馆名录中注明的名录上查找(C: opencvuildx86vc10lib等)。 此外,你应仅具体说明您的平台的名录,即只有<代码>vc9。 (自您重新使用VS2008)和x<86/code>/x64,视您的结构而定。

PRJ0018 press indicated, that thecode>OPENCV_DIR environment/2007/5 is not set out. 您可以在系统房地产诊断中这样做(通常是通过在Win7/Vista的“My Computer”上进行右翼测量和选择“Properties”,你必须到“Ex 预期系统环境”上,在Button有“环境变量”。 但是,如果你已经修改了这些名录,你可以放弃“包括名录”的设置。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签