使用VS2010+CMake编译cryptonotecoinwallet时找不到glu32库
Let's break down why you're hitting this error and walk through actionable fixes step by step:
Root Cause
The glu32.lib library is part of Windows SDK 7.1 (the default SDK for VS2010), but your CMake/Qt configuration isn't correctly locating it—most likely due to a mismatched target architecture or incomplete path setup.
Step 1: Use the Correct VS2010 Command Line Environment
Skip regular command prompts and launch the Visual Studio 2010 x64 Win64 Command Prompt (found in your Start Menu under the Visual Studio 2010 folder). This automatically configures all necessary environment variables for x64 compilation, including paths to the Windows SDK 7.1 libraries, so you don't have to manually set every path.
Step 2: Update Your CMake Command with Architecture-Specific Flags
Your original command didn't specify the x64 target architecture for the generator, which defaults to 32-bit. Fix this and refine your path variables with this updated command:
cmake.exe -DBOOST_ROOT=C:\\boost_1_66_0 -DBOOST_LIBRARYDIR=C:\\boost_1_66_0\\lib32-msvc-10.0 -DCMAKE_PREFIX_PATH="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1" -DCMAKE_LIBRARY_PATH="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Lib\\x64" -G "Visual Studio 10 2010 Win64" .
Key improvements here:
- Added
Win64to the generator flag (-G "Visual Studio 10 2010 Win64") to explicitly target x64 architecture - Expanded
CMAKE_PREFIX_PATHto point to the root of the Windows SDK (not just the lib folder) for better path resolution - Added
CMAKE_LIBRARY_PATHto directly tell CMake where to look for x64 system libraries like glu32
Step 3: Verify Qt Version Architecture Match
Double-check that your Qt 5.2.0 installation (msvc2010_opengl) is built for x64. If you're using a 32-bit Qt build, switch to compiling a 32-bit version of cryptonotecoinwallet instead:
- Use the standard Visual Studio 2010 Command Prompt (32-bit)
- Adjust the SDK path to
C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Lib - Remove
Win64from the generator flag
Step 4: Force CMake to Locate glu32 (If All Else Fails)
If the above steps don't resolve the issue, add this directly to your project's CMakeLists.txt to manually find and link the glu32 library:
# Manually locate glu32 library for x64 find_library(GLU32_LIB NAMES glu32 PATHS "C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Lib\\x64" NO_DEFAULT_PATH ) if(NOT GLU32_LIB) message(FATAL_ERROR "Failed to find glu32.lib in the specified Windows SDK path!") endif() # Link the library to your wallet target (replace with actual target name) target_link_libraries(cryptonotewallet ${GLU32_LIB})
Replace cryptonotewallet with the exact target name defined in the project's CMakeLists.txt.
Final Checks
Ensure you've installed the full Windows SDK 7.1 (not a partial installation) and that no conflicting SDK versions are overriding your path variables on the system.
内容的提问来源于stack exchange,提问作者Praneeth Peiris

