C++ 在windows中编译GLFW源代码
我正在尝试使用CMake+Makefile和MinGW在Win7上编译 我遵循的命令序列是使用cmake生成生成生成文件:C++ 在windows中编译GLFW源代码,c++,opengl,makefile,cmake,glfw,C++,Opengl,Makefile,Cmake,Glfw,我正在尝试使用CMake+Makefile和MinGW在Win7上编译 我遵循的命令序列是使用cmake生成生成生成文件: $ cmake . -G "MinGW Makefiles" -- The C compiler identification is GNU 4.8.1 -- Check for working C compiler: C:/MinGW/bin/gcc.exe -- Check for working C compiler: C:/MinGW/bin/gcc.exe --
$ cmake . -G "MinGW Makefiles"
-- The C compiler identification is GNU 4.8.1
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found Vulkan: C:/VulkanSDK/1.1.77.0/Lib32/vulkan-1.lib
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Looking for dinput.h
-- Looking for dinput.h - not found
-- Looking for xinput.h
-- Looking for xinput.h - not found
-- Performing Test _GLFW_HAS_DEP
-- Performing Test _GLFW_HAS_DEP - Success
-- Performing Test _GLFW_HAS_ASLR
-- Performing Test _GLFW_HAS_ASLR - Success
-- Performing Test _GLFW_HAS_64ASLR
-- Performing Test _GLFW_HAS_64ASLR - Failed
-- Using Win32 for window creation
-- Configuring done
-- Generating done
-- Build files have been written to: `E:/workspace_opengl/PotatoRenderer_CMAKE_tests/libs/glfw`
然后我整理了资料来源:
$ mingw32-make.exe
[ 0%] Building C object src/CMakeFiles/glfw.dir/win32_init.c.obj
E:\workspace_opengl\PotatoRenderer_CMAKE_tests\libs\glfw\src\win32_init.c: In function '_glfwUpdateKeyNamesWin32':
E:\workspace_opengl\PotatoRenderer_CMAKE_tests\libs\glfw\src\win32_init.c:482:42: error: 'MAPVK_VSC_TO_VK' undeclared (first use in this function)
vk = MapVirtualKey(scancode, MAPVK_VSC_TO_VK);
^
E:\workspace_opengl\PotatoRenderer_CMAKE_tests\libs\glfw\src\win32_init.c:482:42: note: each undeclared identifier is reported only once for each function it appears in
In file included from c:\mingw\include\windows.h:48:0,
from E:\workspace_opengl\PotatoRenderer_CMAKE_tests\libs\glfw\src\win32_platform.h:65,
from E:\workspace_opengl\PotatoRenderer_CMAKE_tests\libs\glfw\src\internal.h:186,
from E:\workspace_opengl\PotatoRenderer_CMAKE_tests\libs\glfw\src\win32_init.c:28:
E:\workspace_opengl\PotatoRenderer_CMAKE_tests\libs\glfw\src\win32_init.c: In function '_glfwPlatformInit':
E:\workspace_opengl\PotatoRenderer_CMAKE_tests\libs\glfw\src\win32_platform.h:146:38: error: '_WIN32_WINNT_VISTA' undeclared (first use in this function)
IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), \
^
E:\workspace_opengl\PotatoRenderer_CMAKE_tests\libs\glfw\src\win32_init.c:528:14: note: in expansion of macro 'IsWindowsVistaOrGreater'
else if (IsWindowsVistaOrGreater())
^
src\CMakeFiles\glfw.dir\build.make:146: recipe for target 'src/CMakeFiles/glfw.dir/win32_init.c.obj' failed
mingw32-make[2]: *** [src/CMakeFiles/glfw.dir/win32_init.c.obj] Error 1
CMakeFiles\Makefile2:121: recipe for target 'src/CMakeFiles/glfw.dir/all' failed
mingw32-make[1]: *** [src/CMakeFiles/glfw.dir/all] Error 2
Makefile:128: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
我试着用谷歌搜索一下,但没有发现任何类似的问题。我也尝试手动或没有运气。知道我做错了什么吗
提前感谢您的编译器已过时。使用MinGW-W64,最容易通过MSys2安装