更新我找到了答案并将其发布在评论中。我很生气,虽然这个副本已经关闭了。我所要求的与它标记为的副本相同。
的 ________________________________________
所以我试图从windows中的命令行构建一些OpenGL示例。
我可以在Visual Studio中执行此操作。我想从命令行执行此操作。
我一直在关注learnopengl.com上的教程here。我已经安装了cmake,并构建了GLFW和GLEW的32位库。
当我打开VS2015的开发人员命令提示符时,我输入以下内容来编译我的程序。
cl /EHsc /IC:\Users\Kojo\dev\cpp-include hello_window.cpp /link User32.lib OpenGL32.lib C:\Users\Kojo\dev\cpp-libs\glew32s.lib C:\Users\Kojo\dev\cpp-libs\glfw3-32.lib Gdi32.lib Shell32.lib
我得到以下输出
C:\Users\Kojo\dev\LearnOpenGL>cl /EHsc /IC:\Users\Kojo\dev\cpp-include hello_window.cpp /link User32.lib OpenGL32.lib C:\Users\Kojo\dev\cpp-libs\glew32s.lib C:\Users\Kojo\dev\cpp-libs\glfw3.lib Gdi32.lib Shell32.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
hello_window.cpp
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:hello_window.exe
User32.lib
OpenGL32.lib
C:\Users\Kojo\dev\cpp-libs\glew32s.lib
C:\Users\Kojo\dev\cpp-libs\glfw3.lib
Gdi32.lib
Shell32.lib
hello_window.obj
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
glfw3.lib(init.obj) : warning LNK4217: locally defined symbol ___stdio_common_vsprintf imported in function _vsnprintf
glfw3.lib(wgl_context.obj) : warning LNK4049: locally defined symbol _calloc imported
glfw3.lib(egl_context.obj) : warning LNK4049: locally defined symbol _calloc imported
glfw3.lib(monitor.obj) : warning LNK4049: locally defined symbol _calloc imported
glfw3.lib(vulkan.obj) : warning LNK4049: locally defined symbol _calloc imported
glfw3.lib(win32_window.obj) : warning LNK4217: locally defined symbol _calloc imported in function __glfwPlatformGetClipboardString
glfw3.lib(win32_joystick.obj) : warning LNK4049: locally defined symbol _calloc imported
glfw3.lib(window.obj) : warning LNK4217: locally defined symbol _calloc imported in function _glfwCreateWindow
glfw3.lib(input.obj) : warning LNK4217: locally defined symbol _calloc imported in function _glfwSetTime
glfw3.lib(win32_init.obj) : warning LNK4049: locally defined symbol _calloc imported
glfw3.lib(win32_monitor.obj) : warning LNK4049: locally defined symbol _calloc imported
glfw3.lib(wgl_context.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(egl_context.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(monitor.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(vulkan.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(win32_window.obj) : warning LNK4217: locally defined symbol _free imported in function _acquireMonitor
glfw3.lib(win32_joystick.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(window.obj) : warning LNK4217: locally defined symbol _free imported in function _glfwDestroyWindow
glfw3.lib(input.obj) : warning LNK4217: locally defined symbol _free imported in function _glfwGetTime
glfw3.lib(win32_init.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(win32_monitor.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(monitor.obj) : warning LNK4217: locally defined symbol _qsort imported in function _refreshVideoModes
glfw3.lib(win32_joystick.obj) : warning LNK4049: locally defined symbol _qsort imported
glfw3.lib(vulkan.obj) : error LNK2001: unresolved external symbol __imp___wassert
glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol __imp___wassert
glfw3.lib(egl_context.obj) : error LNK2001: unresolved external symbol __imp___wassert
glfw3.lib(window.obj) : error LNK2001: unresolved external symbol __imp___wassert
glfw3.lib(input.obj) : error LNK2001: unresolved external symbol __imp___wassert
glfw3.lib(context.obj) : error LNK2001: unresolved external symbol __imp___wassert
glfw3.lib(monitor.obj) : error LNK2001: unresolved external symbol __imp___wassert
glfw3.lib(context.obj) : error LNK2019: unresolved external symbol __imp__strstr referenced in function __glfwStringInExtensionString
glfw3.lib(win32_joystick.obj) : error LNK2001: unresolved external symbol __imp__strstr
glfw3.lib(context.obj) : error LNK2019: unresolved external symbol __imp__strncmp referenced in function __glfwRefreshContextAttribs
glfw3.lib(egl_context.obj) : error LNK2001: unresolved external symbol __imp__strncmp
glfw3.lib(context.obj) : error LNK2019: unresolved external symbol __imp____stdio_common_vsscanf referenced in function __vsscanf_l
glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved external symbol __imp__wcscmp referenced in function __glfwPlatformIsSameMonitor
glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved external symbol __imp__wcscpy referenced in function _createMonitor
glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved external symbol __imp__wcslen referenced in function __glfwPlatformIsSameMonitor
glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved external symbol __imp__realloc referenced in function __glfwPlatformGetMonitors
glfw3.lib(monitor.obj) : error LNK2019: unresolved external symbol __imp___strdup referenced in function __glfwAllocMonitor
glfw3.lib(win32_window.obj) : error LNK2001: unresolved external symbol __imp___strdup
glfw3.lib(win32_joystick.obj) : error LNK2001: unresolved external symbol __imp___strdup
MSVCRTD.lib(_chandler4gs_.obj) : error LNK2019: unresolved external symbol __except_handler4_common referenced in function __except_handler4
hello_window.exe : fatal error LNK1120: 10 unresolved externals
我相信它所抱怨的符号是C符号而不是C ++符号让我觉得我可能没有链接一些常见的C库。我已尝试将libcmt.lib
添加到库列表中,但我收到同样的错误。
之前有没有人用CL碰到这样的事情?