错误:在Windows中安装OpenCV(支持CUDA):cmake编译错误Windows10 VS2015 cl.exe-损坏的LNK1104无法打开program.obj

时间:2018-10-29 10:13:22

标签: windows opencv cmake

我一直在尝试将OPENCV 2.4.13.6安装到配备GPU的Windows10计算机中(CUDA9.0,VS2015和cmake3.10.0已安装)。 尽管尝试通过参考https://jamesbowley.co.uk/build-compile-opencv-3-4-in-windows-with-cuda-9-0-and-intel-mkl-tbb/安装opencv 2.4,但出现了以下错误。

错误消息:

The CXX compiler identification is MSVC 19.0.24215.1
The C compiler identification is MSVC 19.0.24215.1
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- broken
CMake Error at share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler

"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeTmp

Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe" "cmTC_678c6.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
Microsoft (R) Build Engine version 14.0.25420.1

Copyright (C) Microsoft Corporation. All rights reserved.


Build started 2018/10/28 21:46:10.

Project "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj" on node 1 (default targets).

PrepareForBuild:

Creating directory "cmTC_678c6.dir\Debug\".

Creating directory "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\Debug\".

Creating directory "cmTC_678c6.dir\Debug\cmTC_678c6.tlog\".

InitializeBuildStatus:

Creating "cmTC_678c6.dir\Debug\cmTC_678c6.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.

ClCompile:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_678c6.dir\Debug\\" /Fd"cmTC_678c6.dir\Debug\vc140.pdb" /Gd /TP /errorReport:queue "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\testCXXCompiler.cxx"

Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64

Copyright (C) Microsoft Corporation. All rights reserved.


cl /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_678c6.dir\Debug\\" /Fd"cmTC_678c6.dir\Debug\vc140.pdb" /Gd /TP /errorReport:queue "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\testCXXCompiler.cxx"


testCXXCompiler.cxx

Link:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\Debug\cmTC_678c6.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeTmp/Debug/cmTC_678c6.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeTmp/Debug/cmTC_678c6.lib" /MACHINE:X64 /machine:x64 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib cmTC_678c6.dir\Debug\testCXXCompiler.obj

LINK : fatal error LNK1104: cannot open file 'C:\Program.obj' [C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj]

Done Building Project "C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj" (default targets) -- FAILED.


Build FAILED.


"C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj" (default target) (1) ->

(Link target) -> 

LINK : fatal error LNK1104: cannot open file 'C:\Program.obj' [C:\opencv\opencv-2.4.13.6\built\CMakeFiles\CMakeTmp\cmTC_678c6.vcxproj]


0 Warning(s)

1 Error(s)


Time Elapsed 00:00:00.42





CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:64 (project)
Configuring incomplete, errors occurred!
See also "C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeOutput.log".
See also "C:/opencv/opencv-2.4.13.6/built/CMakeFiles/CMakeError.log".

尽管我一直在尝试解决以下URL下的错误一周,但是这些URL解决方案不适用于我。

CMake configuring fails. "cl.exe is not able to compile a simple test program"

Why does fatal error "LNK1104: cannot open file 'C:\Program.obj'" occur when I compile a C++ project in Visual Studio?

衷心感谢您为解决该问题提供的指导。

1 个答案:

答案 0 :(得分:0)

我很抱歉使您感到困惑。我发现此错误来自错误的cmake命令错误,该错误与opencv文件无关。 (我只是意识到,即使是简单的cmake测试代码,我也无法将其编译为以下错误。

确定C编译器是否工作失败,并显示以下输出: 更改目录:C:/ Users / hiroa / Desktop / cmaketest / build / CMakeFiles / CMakeTmp

运行构建命令:“ C:/程序文件(x86)/ Microsoft Visual Studio / 2017 /社区/MSBuild/15.0/Bin/MSBuild.exe”“ cmTC_cf44f.vcxproj”“ / p:Configuration = Debug”“ / p:VisualStudioVersion = 15.0“ .NET Framework的Microsoft(R)Build Engine版本15.8.169 + g1ccb72aefa

版权所有(C)Microsoft Corporation。保留所有权利。

构建开始于2018/11/13 22:33:09。

在节点1上的项目“ C:\ Users \ hiroa \ Desktop \ cmaketest \ build \ CMakeFiles \ CMakeTmp \ cmTC_cf44f.vcxproj”(默认目标)。

PrepareForBuild:

创建目录“ cmTC_cf44f.dir \ Debug \”。

创建目录“ C:\ Users \ hiroa \ Desktop \ cmaketest \ build \ CMakeFiles \ CMakeTmp \ Debug \”。

创建目录“ cmTC_cf44f.dir \ Debug \ cmTC_cf44f.tlog \”。

InitializeBuildStatus:

由于指定了“ AlwaysCreate”,因此创建“ cmTC_cf44f.dir \ Debug \ cmTC_cf44f.tlog \ successfulbuild”。

ClCompile:

C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community \ VC \ Tools \ MSVC \ 14.15.26726 \ bin \ HostX86 \ x86 \ CL.exe / c / Zi / W3 / WX- / diagnostics :classic / Od / Ob0 / Oy- / D WIN32 / D _WINDOWS / D“ CMAKE_INTDIR = \” Debug \“” / D _MBCS / Gm- / RTC1 / MDd / GS / Zc:wchar_t / Zc:forScope / Zc:inline / Fo“ cmTC_cf44f.dir \ Debug \” /Fd"cmTC_cf44f.dir\Debug\vc141.pdb“ / Gd / TC / analyze- / FC / errorReport:queue C:\ Users \ hiroa \ Desktop \ cmaketest \ build \ CMakeFiles \ CMakeTmp \ testCCompiler.c

用于x86的Microsoft(R)C / C ++优化编译器版本19.15.26732.1

版权所有(C)Microsoft Corporation。保留所有权利。

cl / c / Zi / W3 / WX- /诊断:经典/ Od / Ob0 / Oy- / D WIN32 / D _WINDOWS / D“ CMAKE_INTDIR = \” Debug \“” / D _MBCS / Gm- / RTC1 / MDd / GS / Zc:wchar_t / Zc:forScope / Zc:inline / Fo“ cmTC_cf44f.dir \ Debug \” /Fd"cmTC_cf44f.dir\Debug\vc141.pdb“ / Gd / TC / analyze- / FC / errorReport:队列C:\ Users \ hiroa \ Desktop \ cmaketest \ build \ CMakeFiles \ CMakeTmp \ testCCompiler.c

testCCompiler.c

链接:

C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community \ VC \ Tools \ MSVC \ 14.15.26726 \ bin \ HostX86 \ x86 \ link.exe / ERRORREPORT:QUEUE / OUT:“ C:\ Users \ hiroa \ Desktop \ cmaketest \ build \ CMakeFiles \ CMakeTmp \ Debug \ cmTC_cf44f.exe” / INCREMENTAL / NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32。 lib advapi32.lib / MANIFEST / MANIFESTUAC:“ level ='asInvoker'uiAccess ='false'” / manifest:embed / DEBUG / PDB:“ C:/ Users / hiroa / Desktop / cmaketest / build / CMakeFiles / CMakeTmp / Debug / cmTC_cf44f.pdb“ / SUBSYSTEM:CONSOLE / TLBID:1 / DYNAMICBASE / NXCOMPAT /IMPLIB:"C:/Users/hiroa/Desktop/cmaketest/build/CMakeFiles/CMakeTmp/Debug/cmTC_cf44f.lib” / MACHINE:X86 / SAFESEH /机器:X86 C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v9.1 \ lib cmTC_cf44f.dir \ Debug \ testCCompiler.obj

LINK:致命错误LNK1104:无法打开文件'C:\ Program.obj'[C:\ Users \ hiroa \ Desktop \ cmaketest \ build \ CMakeFiles \ CMakeTmp \ cmTC_cf44f.vcxproj]

完成的建筑项目“ C:\ Users \ hiroa \ Desktop \ cmaketest \ build \ CMakeFiles \ CMakeTmp \ cmTC_cf44f.vcxproj”(默认目标)-失败。

构建失败。

“ C:\ Users \ hiroa \ Desktop \ cmaketest \ build \ CMakeFiles \ CMakeTmp \ cmTC_cf44f.vcxproj”(默认目标)(1)->

(链接目标)->

LINK:致命错误LNK1104:无法打开文件'C:\ Program.obj'[C:\ Users \ hiroa \ Desktop \ cmaketest \ build \ CMakeFiles \ CMakeTmp \ cmTC_cf44f.vcxproj]

0 Warning(s)

1 Error(s)

经过的时间00:00:00.30

尽管我尝试解决以下URL所涉及的错误,但仍找不到解决方案。 Why does fatal error "LNK1104: cannot open file 'C:\Program.obj'" occur when I compile a C++ project in Visual Studio?

如果能请您解决此问题,我将不胜感激。如上所述,对于我之前的不当帖子,我感到抱歉。