微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

尝试在Windows 10上使用Visual Studio 2005时“无法打开文件'user32.lib'”

如何解决尝试在Windows 10上使用Visual Studio 2005时“无法打开文件'user32.lib'”

我试图将输出与使用Visual Studio 2005编译的C ++ Win32可执行文件进行匹配,所以我试图使用该MSVC来实现。我有一个在CMake中定义的项目。我打开“ Visual Studio 2005命令提示符”,但是当我尝试cmake -G "NMake Makefiles" ..时得到LINK : Fatal error LNK1104: cannot open file 'user32.lib'

这里是CMakeLists.txt

cmake_minimum_required(VERSION 3.15)

# set the project name
project(LEGOStarWaRSSaga)

# add the executable
add_executable(LEGOStarWaRSSaga src/main.cpp)

这是Visual Studio 2005命令提示输出

C:\Users\aprim\Documents\lstsc>mkdir build

C:\Users\aprim\Documents\lstsc>cd build

C:\Users\aprim\Documents\lstsc\build>cmake -G "NMake Makefiles" ..
-- The C compiler identification is MSVC 14.0.50727
-- The CXX compiler identification is MSVC 14.0.50727
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - Failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 8/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 8/VC/bin/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

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

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/aprim/Documents/lstsc/build/CMakeFiles/CMakeTmp

    Run Build Command(s):nmake /nologo cmTC_41947\fast &&       "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\BIN\nmake.exe"  -f CMakeFiles\cmTC_41947.dir\build.make /nologo -L                  CMakeFiles\cmTC_41947.dir\build
    Building C object CMakeFiles/cmTC_41947.dir/testCCompiler.c.obj
        C:\PROGRA~2\MI30EB~1\VC\bin\cl.exe @C:\Users\aprim\AppData\Local\Temp\nmBDB4.tmp
    testCCompiler.c
    Linking C executable cmTC_41947.exe
        "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_41947.dir --rc=C:\PROGRA~2\MI30EB~1\VC\bin\rc.exe --mt=C:\PROGRA~2\MI30EB~1\VC\bin\mt.exe --manifests -- C:\PROGRA~2\MI30EB~1\VC\bin\link.exe /nologo @CMakeFiles\cmTC_41947.dir\objects1.rsp @C:\Users\aprim\AppData\Local\Temp\nmBE13.tmp
    LINK Pass 1: command "C:\PROGRA~2\MI30EB~1\VC\bin\link.exe /nologo @CMakeFiles\cmTC_41947.dir\objects1.rsp /out:cmTC_41947.exe /implib:cmTC_41947.lib /pdb:C:\Users\aprim\Documents\lstsc\build\CMakeFiles\CMakeTmp\cmTC_41947.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL:YES /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_41947.dir/intermediate.manifest CMakeFiles\cmTC_41947.dir/manifest.res" Failed (exit code 1104) with the following output:
    LINK : Fatal error LNK1104: cannot open file 'user32.lib'
    NMAKE : Fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
    Stop.
    NMAKE : Fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\BIN\nmake.exe"' : return code '0x2'
    Stop.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:4 (project)


-- Configuring incomplete,errors occurred!
See also "C:/Users/aprim/Documents/lstsc/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/aprim/Documents/lstsc/build/CMakeFiles/CMakeError.log".

在线阅读后,我发现这与缺少Windows SDK有关。但是,我安装了Windows SDK 7.1和10.0。我想念什么?

要点是,如果有一个构建工具可使克隆该项目的人员(几乎)可以无缝进行该过程。


编辑:使用完整的Visual C ++选项安装Visual Studio 2005 Professional可以正确安装SDK,并生成项目。我担心的是,并不是每个人都可以使用VS 2005 Pro。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?