LINK1104 的 Opencv 构建错误

Posted

技术标签:

【中文标题】LINK1104 的 Opencv 构建错误【英文标题】:Opencv Build error with LINK1104 【发布时间】:2017-05-02 04:22:28 【问题描述】:

我正在使用 Visual Studio 2013 在 Windows 中构建 opencv-2.4.9。首先我使用 Cmake 进行配置和生成。

然后使用 Visual Studio 2013 构建。

我在构建中发现错误 LNK1104。

可能出了什么问题?

错误是针对所有库的,它们无法链接。

错误如下。

Error   30  error LNK1104: cannot open file '..\..\lib\Debug\opencv_calib3d249d.lib'    E:\opencv-2.4.9\build\modules\ocl\LINK  opencv_ocl
Error   31  error LNK1104: cannot open file '..\..\lib\Debug\opencv_legacy249d.lib' E:\opencv-2.4.9\build\modules\legacy\LINK   opencv_test_legacy
Error   32  error LNK1104: cannot open file '..\..\..\lib\Debug\opencv_gpu249d.lib' E:\opencv-2.4.9\build\modules\gpu\perf4au\LINK  gpu_perf4au
Error   33  error MSB6006: "cmd.exe" exited with code 1.    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets  170 5   opencv_nonfree
Error   34  error MSB6006: "cmd.exe" exited with code 1.    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets  170 5   opencv_superres
Error   35  error LNK1104: cannot open file '..\..\lib\Debug\opencv_features2d249d.lib' E:\opencv-2.4.9\build\modules\imgproc\LINK  opencv_perf_imgproc
Error   36  error LNK1104: cannot open file '..\..\lib\Debug\opencv_superres249d.lib'   E:\opencv-2.4.9\build\modules\superres\LINK opencv_test_superres
Error   37  error LNK1104: cannot open file '..\..\lib\Debug\opencv_objdetect249d.lib'  E:\opencv-2.4.9\build\apps\haartraining\LINK    opencv_haartraining
Error   38  error LNK1104: cannot open file '..\..\lib\Debug\opencv_objdetect249d.lib'  E:\opencv-2.4.9\build\apps\haartraining\LINK    opencv_createsamples
Error   39  error LNK1104: cannot open file '..\..\lib\Debug\opencv_gpu249d.lib'    E:\opencv-2.4.9\build\modules\videostab\LINK    opencv_videostab
Error   40  error LNK1104: cannot open file '..\..\lib\Debug\opencv_superres249d.lib'   E:\opencv-2.4.9\build\modules\superres\LINK opencv_perf_superres
Error   41  error LNK1104: cannot open file '..\..\lib\Debug\opencv_objdetect249d.lib'  E:\opencv-2.4.9\build\apps\haartraining\LINK    opencv_performance
Error   42  error LNK1104: cannot open file '..\..\lib\Debug\opencv_nonfree249d.lib'    E:\opencv-2.4.9\build\modules\nonfree\LINK  opencv_test_nonfree
Error   43  error LNK1104: cannot open file '..\..\lib\Debug\opencv_nonfree249d.lib'    E:\opencv-2.4.9\build\modules\nonfree\LINK  opencv_perf_nonfree
Error   44  error LNK1104: cannot open file '..\..\lib\Debug\opencv_nonfree249d.lib'    E:\opencv-2.4.9\build\modules\stitching\LINK    opencv_stitching
Error   45  error LNK1104: cannot open file '..\..\lib\Debug\opencv_nonfree249d.lib'    E:\opencv-2.4.9\build\modules\contrib\LINK  opencv_contrib
Error   46  error LNK1104: cannot open file '..\..\lib\Debug\opencv_objdetect249d.lib'  E:\opencv-2.4.9\build\apps\traincascade\LINK    opencv_traincascade
Error   47  error LNK1104: cannot open file '..\..\lib\Debug\opencv_stitching249d.lib'  E:\opencv-2.4.9\build\modules\stitching\LINK    opencv_test_stitching
Error   48  error LNK1104: cannot open file '..\..\lib\Debug\opencv_stitching249d.lib'  E:\opencv-2.4.9\build\modules\stitching\LINK    opencv_perf_stitching
Error   49  error LNK1104: cannot open file '..\..\lib\Debug\opencv_contrib249d.lib'    E:\opencv-2.4.9\build\modules\contrib\LINK  opencv_test_contrib
Error   50  error LNK1104: cannot open file '..\..\lib\Debug\opencv_ocl249d.lib'    E:\opencv-2.4.9\build\modules\ocl\LINK  opencv_perf_ocl
Error   51  error LNK1104: cannot open file '..\..\lib\Debug\opencv_ocl249d.lib'    E:\opencv-2.4.9\build\modules\ocl\LINK  opencv_test_ocl
Error   52  error LNK1104: cannot open file '..\..\lib\Debug\opencv_gpu249d.lib'    E:\opencv-2.4.9\build\modules\gpu\LINK  opencv_perf_gpu
Error   53  error LNK1104: cannot open file '..\..\lib\Debug\opencv_gpu249d.lib'    E:\opencv-2.4.9\build\modules\gpu\LINK  opencv_test_gpu

【问题讨论】:

现在我发现了问题。对于在 Windows 中构建,下载和构建 Windows 版本是安全的。 【参考方案1】:

问题出在配置步骤中。在按下生成按钮之前,请确保您指定了适当的配置。在这个link 中,您可以找到构建opencv 的配置示例。特别要注意“WITH”部分。

【讨论】:

以上是关于LINK1104 的 Opencv 构建错误的主要内容,如果未能解决你的问题,请参考以下文章

Qt Creator 链接器错误:LNK1104:无法打开文件“opencv_core249d.lib”

VS报错:LINK : fatal error LNK1104: 无法打开文件“msvcp100d.lib”

无法运行简单的 Visual Studio 2013 项目

致命错误 LNK1104 C++

错误 1 ​​错误 LNK1104:无法打开文件 'opencv_calib3d2413d.obj'

链接:致命错误 LNK1104:无法打开文件 'ucrt.lib'