DevCpp上的OpenCV 2.3.1中的链接器滋扰

时间:2012-01-10 11:18:40

标签: opencv linker runtime-error dev-c++

关于我的环境的一点描述: 在Windows Vista Home Premium SP1 32位上使用OpenCV 2.3.1的DevCpp 4.9.9.2

关于我的项目 - 我的项目的.dev(FirstCVproj.dev)文件在c:... \ Desktop \ proj \ openCV \中,我正在尝试编译“facedetect.cpp”的程序在c:\的OpenCV \样品\ C

DevCpp中工具 - >编译器中的OpenCV编译器配置是:

编译器命令

-L"C:\opencv\build\x86\mingw\lib" -llibopencv_core231 -llibopencv_imgproc231 -llibopencv_calib3d231 -llibopencv_video231 -llibopencv_features2d231 -llibopencv_ml231 -llibopencv_highgui231 -llibopencv_objdetect231 -llibopencv_contrib231 -llibopencv_legacy231 -llibopencv_flann231

链接器命令

-llibopencv_core231 -llibopencv_imgproc231 -llibopencv_calib3d231 -llibopencv_video231 -llibopencv_features2d231 -llibopencv_ml231 -llibopencv_highgui231 -llibopencv_objdetect231 -llibopencv_contrib231 -llibopencv_legacy231 -llibopencv_flann231

库目录:opencv \ build \ x86 \ mingw \ lib

二进制目录:opencv \ build \ x86 \ mingw \ bin

包含目录:opencv文件夹中的所有包含文件夹(位于\ build和主文件夹下)

所以在我决定发布这里之前,我在这里按顺序说明了问题:

找不到

libgcc_s_dw2_1.dll。尝试重新安装该应用程序

Program can't find libgcc_s_dw2-1.dll

libstdc ++ - 6.dll未找到。尝试重新安装该应用程序 libstdc++-6.dll not found

因为在链接器命令行选项框中使用-static或-static-libgcc或-static-libstdc ++对我来说不起作用,我将第一个dll文件从我系统中的其他目录复制到我的项目目录中(并且没有在C:\ DevCpp中的mingw32文件夹中)并从网上下载第二个,我的项目停止给出运行时错误,如“FirsCVProj已停止工作。请联系应用程序供应商寻求支持”或“.dll未找到“

但它变得更糟,因为在运行时,我确实看到了我在项目中编译的程序的命令输出窗口,但这只是在几分之一秒内出现了!

我重建整个事情几次,但后来记得爱因斯坦的引用“重复同样的事情并期待不同的输出是疯狂”我停止了.. 这就是你们进来的地方。这是编译日志,我不禁想知道文件没有链接的原因。

Compiler: OpenCV
Building Makefile: "C:\Users\ronnieaka\Desktop\PROJ\openCV\Makefile.win"
Executing  make clean
rm -f ../../../../../opencv/samples/c/facedetect.o  FirstCVproj.exe
g++.exe -c ../../../../../opencv/samples/c/facedetect.cpp -o ../../../../../opencv/samples/c/facedetect.o -I"lib/gcc/mingw32/3.4.2/include"  -I"include/c++/3.4.2/backward"  -I"include/c++/3.4.2/mingw32"  -I"include/c++/3.4.2"  -I"include"  -I"C:/opencv/include"  -I"C:/opencv/include/opencv"  -I"C:/opencv/include/opencv2"  -I"C:/opencv/build/include"  -I"C:/opencv/build/include/opencv"  -I"C:/opencv/build/include/opencv2"    -L"C:\opencv\build\x86\mingw\lib" -llibopencv_core231 -llibopencv_imgproc231 -llibopencv_calib3d231 -llibopencv_video231 -llibopencv_features2d231 -llibopencv_ml231 -llibopencv_highgui231 -llibopencv_objdetect231 -llibopencv_contrib231 -llibopencv_legacy231 -llibopencv_flann231
g++.exe: -llibopencv_core231: linker input file unused because linking not done
g++.exe: -llibopencv_imgproc231: linker input file unused because linking not done
g++.exe: -llibopencv_calib3d231: linker input file unused because linking not done
g++.exe: -llibopencv_video231: linker input file unused because linking not done
g++.exe: -llibopencv_features2d231: linker input file unused because linking not done
g++.exe: -llibopencv_ml231: linker input file unused because linking not done
g++.exe: -llibopencv_highgui231: linker input file unused because linking not done
g++.exe: -llibopencv_objdetect231: linker input file unused because linking not done
g++.exe: -llibopencv_contrib231: linker input file unused because linking not done
g++.exe: -llibopencv_legacy231: linker input file unused because linking not done
g++.exe: -llibopencv_flann231: linker input file unused because linking not done
g++.exe ../../../../../opencv/samples/c/facedetect.o  -o "FirstCVproj.exe" -L"lib" -L"C:/opencv/build/x86/mingw/lib" -llibopencv_core231 -llibopencv_imgproc231 -llibopencv_calib3d231 -llibopencv_video231 -llibopencv_features2d231 -llibopencv_ml231 -llibopencv_highgui231 -llibopencv_objdetect231 -llibopencv_contrib231 -llibopencv_legacy231 -llibopencv_flann231  
Execution terminated
Compilation successful

编辑:

我也试过opencv \ samples \ c \ mushroom.cpp,我得到了输出窗口,其中打印了程序的详细信息,关于其作者等,但随后我收到了Windows消息:“FirstCVproj已停止工作”

1 个答案:

答案 0 :(得分:1)

可以在命令行中看到您要将此路径添加为库路径:

-L"C:\opencv\build\x86\mingw\lib" 

您需要确认这是正确的目录,确认可以找到所有这些文件

libopencv_core231 libopencv_imgproc231 libopencv_calib3d231 libopencv_video231
libopencv_features2d231 libopencv_ml231 libopencv_highgui231 libopencv_objdetect231 
libopencv_contrib231 libopencv_legacy231 libopencv_flann231

我没有安装Dev-C ++,也没有推荐它。发布的最后一个正式版本可以追溯到2005年2月22日:

  

Colin Laplace stated that he was busy with real-life issues and did not have time to continue development of Dev-C++.

我强烈建议你转移到另一个编译器,如果你考虑使用Visual Studio Express(免费),你可以follow this tutorial to configure OpenCV

修改

您应该添加的库目录是具有 .a 文件的库目录,它可能与具有DLL的文件目录不同。请记住,DLL在应用程序执行时使用,而不是在应用程序处于构建(链接)过程中时使用。

修改

请勿将库文件包含为-llibopencv_core231,请将其作为-lopencv_core231