使用与opencv fftw3 Visual Studio 2010中的链接错误 [英] Linker error using openCV with fftw3 Visual Studio 2010
问题描述
我有麻烦试图用OpenCV的实现fftw3在同一个项目。
我是新的C / C ++和任何帮助将非常AP preciated。
以下是只是一个样本code,我用:
I'm having trouble trying to implement fftw3 with openCV in the same project. I'm new to c/c++ and any help will be much appreciated. The following is just a sample code i used:
#include "fftw3.h"
#include <stdlib.h>
int main(){
fftw_complex *in, *out;
fftw_plan p;
int N=8;
in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
for(int i=0; i<N; i++){
in[i][0]=i;
in[i][1]=0;
}
fftw_execute(p);
for(int i=0; i<N; i++){
printf("R->%f\tI->%f\n", out[i][0], out[i][1]);
}
system("pause");
fftw_destroy_plan(p);
fftw_free(in); fftw_free(out);
}
在code正在编制罚款时,它在自己的项目。
但是,当我试图在fftw3和OpenCV链接在一起,我得到一个链接错误:
The code is compiling fine when its in its own project. But when I'm trying to link the fftw3 and openCV together i get a linker error:
1>video.obj : error LNK2001: unresolved external symbol _fftw_destroy_plan
1>video.obj : error LNK2001: unresolved external symbol _fftw_execute
1>video.obj : error LNK2001: unresolved external symbol _fftw_plan_dft_2d
1>video.obj : error LNK2001: unresolved external symbol _fftw_malloc
1>video.obj : error LNK2001: unresolved external symbol _fftw_free
1>D:\C WorkSpace\Viedo_CV\Video test\Release\Video test.exe : fatal error LNK1120: 5 unresolved externals
1>
1>Build FAILED.
我双重检查所有的连接器的配置,他们似乎要被罚款(正如我所说的一切都在一个单独的项目时,运作良好)。
OpenCV库工作正常。
不幸的是我不能发布我的真实code。
所有我使用OpenCV的是:
I double checked all the linker configurations and they seem to be fine(as i said all is working well when in a separate projects). The openCV library is working fine. Unfortunately I can't post my real code. All the openCV i use is in:
#include <opencv\\cv.h>
#include <opencv\\highgui.h>
#include <windows.h>
任何帮助将非常AP preciated。
Any help will be much appreciated.
推荐答案
我想通了,当我安装的OpenCV我创建了一个环境变量来OpenCV的生成位置,并添加OpenCV的DLL的位置到Path变量。
我没有注意到的是,我加的DLL的x86版本的Path变量,我的项目是设置为64,它在另一个项目工作的原因是因为我复制了64位DLL的项目文件夹它的自我。
所有工作正常后,我编辑的路径正确的DLL 64的位置。
I got it figured out, when I installed openCV I created an environmental variable to the openCV build location and added the openCV DLL's location to the Path variable. What i didn't notice is that I added the x86 version of the DLL's to the Path variable and my project was setup as x64, the reason it worked in another project is because I copied the x64 DLL's to the project folder it self. All worked fine after I edited the Path to the correct x64 DLL's location.
这篇关于使用与opencv fftw3 Visual Studio 2010中的链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!