与glfw3链接时发生错误

发布于 2025-01-26 19:38:35 字数 17617 浏览 2 评论 0 原文

我一直在尝试编译C ++代码,并且最近不依赖IDE, 我决定使用编辑和命令行来编写和编译代码。

问题是我想制作一个GLFW应用程序,但是当我与glfw3.lib和OpenGl32.lib链接时,我会遇到错误:

a.exe:致命错误lnk1120:92未解决的外部

OS:Windows 7
编译器:Clang

SRC/Main.CPP:

#include <stdlib.h>
#include <stdio.h>

#include "window.h"

#define WIDTH 800
#define HEIGHT 600

int main(int argc, char* argv[]){
    if (!Window_init(WIDTH, HEIGHT, "HELLOWORLD")){
        printf("Problem loading window!\n");
        return 1;
    }
    return 0;    
}

SRC/Window.H

#ifndef WINDOW_H
#define WINDOW_H

#include "GLFW/glfw3.h"

#define GLFW_INCLUDE_NONE

static GLFWwindow* window;

int Window_init(int width, int height, char* title);
void Window_update();

int Window_init(int width, int height, char* title){
    if (!glfwInit())return 0;
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
    window = glfwCreateWindow(width, height, title,NULL, NULL);
    if (!window){
        return 0;
    }

    glfwMakeContextCurrent(window);
    return 1;

}

void Window_update(){

}

#endif // !WINDOW_H

编译命令:

clang++ ..\src\*.cpp ..\src\*.h -L..\lib -lglfw3 -lopengl32 -I..\include\ -std=c++17 

错误:

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
glfw3.lib(init.c.obj) : warning LNK4217: locally defined symbol ___stdio_common_vsprintf imported in function __glfwInputError
glfw3.lib(wgl_context.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(egl_context.c.obj) : warning LNK4217: locally defined symbol _free imported in function __glfwInitEGL
glfw3.lib(monitor.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(vulkan.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(win32_window.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(win32_joystick.c.obj) : warning LNK4217: locally defined symbol _free imported in function _pollJoystickState
glfw3.lib(window.c.obj) : warning LNK4217: locally defined symbol _free imported in function _glfwDestroyWindow
glfw3.lib(input.c.obj) : warning LNK4217: locally defined symbol _free imported in function _glfwSetInputMode
glfw3.lib(win32_init.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(win32_monitor.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(monitor.c.obj) : warning LNK4217: locally defined symbol _qsort imported in function _refreshVideoModes
glfw3.lib(win32_joystick.c.obj) : warning LNK4049: locally defined symbol _qsort imported
glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(vulkan.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(input.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp__strstr referenced in function __glfwStringInExtensionString
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp__strstr
glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp__strncmp referenced in function __glfwRefreshContextAttribs
glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __imp__strncmp
glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp____stdio_common_vsscanf referenced in function __vsscanf_l
glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__RegisterDeviceNotificationW@12 referenced in function _createHelperWindow
glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__CreateWindowExW@48 referenced in function _createHelperWindow
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__CreateWindowExW@48
glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function __glfwPlatformTerminate
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__DestroyWindow@4
glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function _createHelperWindow
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__ShowWindow@8
glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__SystemParametersInfoW@16 referenced in function __glfwPlatformInit
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__CreateDCW@16 referenced in function __glfwPlatformGetGammaRamp
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__DeleteDC@4 referenced in function __glfwPlatformGetGammaRamp
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__GetDeviceCaps@8 referenced in function _createMonitor
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__GetDeviceGammaRamp@8 referenced in function __glfwPlatformGetGammaRamp
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__SetDeviceGammaRamp@8 referenced in function __glfwPlatformSetGammaRamp
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__ChangeDisplaySettingsExW@20 referenced in function __glfwPlatformGetVideoModes
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__EnumDisplaySettingsW@12 referenced in function __glfwPlatformGetVideoMode
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__EnumDisplaySettingsExW@16 referenced in function __glfwPlatformGetMonitorPos
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__EnumDisplayDevicesW@16 referenced in function __glfwPlatformGetMonitors
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__realloc referenced in function __glfwPlatformGetMonitors
glfw3.lib(monitor.c.obj) : error LNK2019: unresolved external symbol __imp___strdup referenced in function __glfwAllocMonitor
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp___strdup
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp___strdup
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__CreateBitmap@20 referenced in function _createIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DeleteObject@4 referenced in function _createIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__CreateDIBSection@24 referenced in function _createIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__TrackMouseEvent@4 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DispatchMessageW@4 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__PeekMessageW@20 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetMessageTime@0 referenced in function _translateKey
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SendMessageW@16 referenced in function __glfwPlatformSetWindowIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__PostMessageW@16 referenced in function __glfwPlatformPostEmptyEvent
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__WaitMessage@0 referenced in function __glfwPlatformWaitEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DefWindowProcW@16 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__UnregisterClassW@8 referenced in function __glfwUnregisterWindowClassWin32
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__RegisterClassExW@4 referenced in function __glfwRegisterWindowClassWin32
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__MoveWindow@24 referenced in function __glfwPlatformSetWindowAspectRatio
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetWindowPos@28 referenced in function __glfwPlatformSetWindowMonitor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__IsWindowVisible@4 referenced in function __glfwPlatformWindowVisible
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__IsIconic@4 referenced in function __glfwPlatformWindowIconified
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__BringWindowToTop@4 referenced in function __glfwPlatformCreateWindow
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__IsZoomed@4 referenced in function __glfwPlatformWindowMaximized
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__OpenClipboard@4 referenced in function __glfwPlatformGetClipboardString
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__CloseClipboard@0 referenced in function __glfwPlatformGetClipboardString
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetClipboardData@8 referenced in function __glfwPlatformSetClipboardString
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetClipboardData@4 referenced in function __glfwPlatformGetClipboardString
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__EmptyClipboard@0 referenced in function __glfwPlatformSetClipboardString
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetFocus@4 referenced in function __glfwPlatformCreateWindow
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetActiveWindow@0 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetKeyState@4 referenced in function _getKeyMods
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetAsyncKeyState@4 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetKeyNameTextW@12 referenced in function __glfwPlatformGetKeyName
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetCapture@4 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__ReleaseCapture@0 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__MsgWaitForMultipleObjects@20 referenced in function __glfwPlatformWaitEventsTimeout
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetSystemMetrics@4 referenced in function __glfwPlatformSetWindowIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetForegroundWindow@4 referenced in function __glfwPlatformCreateWindow
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetDC@4 referenced in function _createIcon
glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __imp__GetDC@4
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__ReleaseDC@8 referenced in function _createIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetPropW@12 referenced in function _createNativeWindow
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetPropW@8 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__RemovePropW@8 referenced in function __glfwPlatformDestroyWindow
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetWindowTextW@8 referenced in function __glfwPlatformSetWindowTitle
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetClientRect@8 referenced in function __glfwPlatformGetFramebufferSize
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetWindowRect@8 referenced in function __glfwPlatformSetWindowAspectRatio
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__AdjustWindowRectEx@16 referenced in function __glfwPlatformGetWindowFrameSize
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetCursorPos@8 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetCursor@4 referenced in function __glfwPlatformSetCursor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetCursorPos@4 referenced in function __glfwPlatformGetCursorPos
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__ClipCursor@4 referenced in function __glfwPlatformSetCursorMode
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__ClientToScreen@8 referenced in function __glfwPlatformGetWindowPos
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__ScreenToClient@8 referenced in function __glfwPlatformGetCursorPos
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__WindowFromPoint@8 referenced in function _cursorInClientArea
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetRect@20 referenced in function __glfwPlatformGetWindowFrameSize
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__PtInRect@12 referenced in function _cursorInClientArea
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetWindowLongW@8 referenced in function __glfwPlatformSetWindowMonitor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetWindowLongW@12 referenced in function __glfwPlatformSetWindowMonitor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetClassLongW@8 referenced in function __glfwPlatformSetWindowIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__LoadCursorW@8 referenced in function __glfwPlatformCreateStandardCursor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DestroyIcon@4 referenced in function __glfwPlatformDestroyCursor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__LoadImageW@24 referenced in function __glfwRegisterWindowClassWin32
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__CreateIconIndirect@4 referenced in function _createIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__CopyIcon@4 referenced in function __glfwPlatformCreateStandardCursor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DragQueryFileW@16 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DragQueryPoint@8 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DragFinish@4 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DragAcceptFiles@8 referenced in function _createNativeWindow
glfw3.lib(win32_joystick.c.obj) : error LNK2019: unresolved external symbol __imp__GetRawInputDeviceInfoA@16 referenced in function _supportsXInput
glfw3.lib(win32_joystick.c.obj) : error LNK2019: unresolved external symbol __imp__GetRawInputDeviceList@12 referenced in function _supportsXInput
glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__ChoosePixelFormat@8 referenced in function _loadWGLExtensions
glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__DescribePixelFormat@16 referenced in function __glfwCreateContextWGL
glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__SetPixelFormat@12 referenced in function __glfwCreateContextWGL
glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__SwapBuffers@4 referenced in function _swapBuffersWGL
MSVCRT.lib(_chandler4gs_.obj) : error LNK2019: unresolved external symbol __except_handler4_common referenced in function __except_handler4
a.exe : fatal error LNK1120: 92 unresolved externals
clang++.exe: error: linker command failed with exit code 1120 (use -v to see invocation)

I've been trying to compile C++ code and dont reliant on IDE recently,
and I decided to use an editor and command line to write and compile code.

And the problem is I want to make a glfw app but I get an error when I linking with glfw3.lib and opengl32.lib:

a.exe : fatal error LNK1120: 92 unresolved externals

os: Windows 7
compiler: clang

src/main.cpp:

#include <stdlib.h>
#include <stdio.h>

#include "window.h"

#define WIDTH 800
#define HEIGHT 600

int main(int argc, char* argv[]){
    if (!Window_init(WIDTH, HEIGHT, "HELLOWORLD")){
        printf("Problem loading window!\n");
        return 1;
    }
    return 0;    
}

src/window.h

#ifndef WINDOW_H
#define WINDOW_H

#include "GLFW/glfw3.h"

#define GLFW_INCLUDE_NONE

static GLFWwindow* window;

int Window_init(int width, int height, char* title);
void Window_update();

int Window_init(int width, int height, char* title){
    if (!glfwInit())return 0;
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
    window = glfwCreateWindow(width, height, title,NULL, NULL);
    if (!window){
        return 0;
    }

    glfwMakeContextCurrent(window);
    return 1;

}

void Window_update(){

}

#endif // !WINDOW_H

Compile command:

clang++ ..\src\*.cpp ..\src\*.h -L..\lib -lglfw3 -lopengl32 -I..\include\ -std=c++17 

error:

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
glfw3.lib(init.c.obj) : warning LNK4217: locally defined symbol ___stdio_common_vsprintf imported in function __glfwInputError
glfw3.lib(wgl_context.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(egl_context.c.obj) : warning LNK4217: locally defined symbol _free imported in function __glfwInitEGL
glfw3.lib(monitor.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(vulkan.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(win32_window.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(win32_joystick.c.obj) : warning LNK4217: locally defined symbol _free imported in function _pollJoystickState
glfw3.lib(window.c.obj) : warning LNK4217: locally defined symbol _free imported in function _glfwDestroyWindow
glfw3.lib(input.c.obj) : warning LNK4217: locally defined symbol _free imported in function _glfwSetInputMode
glfw3.lib(win32_init.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(win32_monitor.c.obj) : warning LNK4049: locally defined symbol _free imported
glfw3.lib(monitor.c.obj) : warning LNK4217: locally defined symbol _qsort imported in function _refreshVideoModes
glfw3.lib(win32_joystick.c.obj) : warning LNK4049: locally defined symbol _qsort imported
glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(vulkan.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(input.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __imp__calloc
glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp__strstr referenced in function __glfwStringInExtensionString
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp__strstr
glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp__strncmp referenced in function __glfwRefreshContextAttribs
glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __imp__strncmp
glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp____stdio_common_vsscanf referenced in function __vsscanf_l
glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__RegisterDeviceNotificationW@12 referenced in function _createHelperWindow
glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__CreateWindowExW@48 referenced in function _createHelperWindow
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__CreateWindowExW@48
glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function __glfwPlatformTerminate
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__DestroyWindow@4
glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function _createHelperWindow
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__ShowWindow@8
glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__SystemParametersInfoW@16 referenced in function __glfwPlatformInit
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__CreateDCW@16 referenced in function __glfwPlatformGetGammaRamp
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__DeleteDC@4 referenced in function __glfwPlatformGetGammaRamp
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__GetDeviceCaps@8 referenced in function _createMonitor
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__GetDeviceGammaRamp@8 referenced in function __glfwPlatformGetGammaRamp
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__SetDeviceGammaRamp@8 referenced in function __glfwPlatformSetGammaRamp
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__ChangeDisplaySettingsExW@20 referenced in function __glfwPlatformGetVideoModes
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__EnumDisplaySettingsW@12 referenced in function __glfwPlatformGetVideoMode
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__EnumDisplaySettingsExW@16 referenced in function __glfwPlatformGetMonitorPos
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__EnumDisplayDevicesW@16 referenced in function __glfwPlatformGetMonitors
glfw3.lib(win32_monitor.c.obj) : error LNK2019: unresolved external symbol __imp__realloc referenced in function __glfwPlatformGetMonitors
glfw3.lib(monitor.c.obj) : error LNK2019: unresolved external symbol __imp___strdup referenced in function __glfwAllocMonitor
glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp___strdup
glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp___strdup
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__CreateBitmap@20 referenced in function _createIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DeleteObject@4 referenced in function _createIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__CreateDIBSection@24 referenced in function _createIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__TrackMouseEvent@4 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DispatchMessageW@4 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__PeekMessageW@20 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetMessageTime@0 referenced in function _translateKey
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SendMessageW@16 referenced in function __glfwPlatformSetWindowIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__PostMessageW@16 referenced in function __glfwPlatformPostEmptyEvent
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__WaitMessage@0 referenced in function __glfwPlatformWaitEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DefWindowProcW@16 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__UnregisterClassW@8 referenced in function __glfwUnregisterWindowClassWin32
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__RegisterClassExW@4 referenced in function __glfwRegisterWindowClassWin32
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__MoveWindow@24 referenced in function __glfwPlatformSetWindowAspectRatio
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetWindowPos@28 referenced in function __glfwPlatformSetWindowMonitor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__IsWindowVisible@4 referenced in function __glfwPlatformWindowVisible
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__IsIconic@4 referenced in function __glfwPlatformWindowIconified
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__BringWindowToTop@4 referenced in function __glfwPlatformCreateWindow
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__IsZoomed@4 referenced in function __glfwPlatformWindowMaximized
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__OpenClipboard@4 referenced in function __glfwPlatformGetClipboardString
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__CloseClipboard@0 referenced in function __glfwPlatformGetClipboardString
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetClipboardData@8 referenced in function __glfwPlatformSetClipboardString
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetClipboardData@4 referenced in function __glfwPlatformGetClipboardString
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__EmptyClipboard@0 referenced in function __glfwPlatformSetClipboardString
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetFocus@4 referenced in function __glfwPlatformCreateWindow
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetActiveWindow@0 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetKeyState@4 referenced in function _getKeyMods
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetAsyncKeyState@4 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetKeyNameTextW@12 referenced in function __glfwPlatformGetKeyName
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetCapture@4 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__ReleaseCapture@0 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__MsgWaitForMultipleObjects@20 referenced in function __glfwPlatformWaitEventsTimeout
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetSystemMetrics@4 referenced in function __glfwPlatformSetWindowIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetForegroundWindow@4 referenced in function __glfwPlatformCreateWindow
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetDC@4 referenced in function _createIcon
glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __imp__GetDC@4
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__ReleaseDC@8 referenced in function _createIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetPropW@12 referenced in function _createNativeWindow
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetPropW@8 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__RemovePropW@8 referenced in function __glfwPlatformDestroyWindow
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetWindowTextW@8 referenced in function __glfwPlatformSetWindowTitle
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetClientRect@8 referenced in function __glfwPlatformGetFramebufferSize
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetWindowRect@8 referenced in function __glfwPlatformSetWindowAspectRatio
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__AdjustWindowRectEx@16 referenced in function __glfwPlatformGetWindowFrameSize
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetCursorPos@8 referenced in function __glfwPlatformPollEvents
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetCursor@4 referenced in function __glfwPlatformSetCursor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetCursorPos@4 referenced in function __glfwPlatformGetCursorPos
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__ClipCursor@4 referenced in function __glfwPlatformSetCursorMode
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__ClientToScreen@8 referenced in function __glfwPlatformGetWindowPos
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__ScreenToClient@8 referenced in function __glfwPlatformGetCursorPos
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__WindowFromPoint@8 referenced in function _cursorInClientArea
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetRect@20 referenced in function __glfwPlatformGetWindowFrameSize
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__PtInRect@12 referenced in function _cursorInClientArea
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetWindowLongW@8 referenced in function __glfwPlatformSetWindowMonitor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__SetWindowLongW@12 referenced in function __glfwPlatformSetWindowMonitor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__GetClassLongW@8 referenced in function __glfwPlatformSetWindowIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__LoadCursorW@8 referenced in function __glfwPlatformCreateStandardCursor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DestroyIcon@4 referenced in function __glfwPlatformDestroyCursor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__LoadImageW@24 referenced in function __glfwRegisterWindowClassWin32
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__CreateIconIndirect@4 referenced in function _createIcon
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__CopyIcon@4 referenced in function __glfwPlatformCreateStandardCursor
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DragQueryFileW@16 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DragQueryPoint@8 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DragFinish@4 referenced in function _windowProc@16
glfw3.lib(win32_window.c.obj) : error LNK2019: unresolved external symbol __imp__DragAcceptFiles@8 referenced in function _createNativeWindow
glfw3.lib(win32_joystick.c.obj) : error LNK2019: unresolved external symbol __imp__GetRawInputDeviceInfoA@16 referenced in function _supportsXInput
glfw3.lib(win32_joystick.c.obj) : error LNK2019: unresolved external symbol __imp__GetRawInputDeviceList@12 referenced in function _supportsXInput
glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__ChoosePixelFormat@8 referenced in function _loadWGLExtensions
glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__DescribePixelFormat@16 referenced in function __glfwCreateContextWGL
glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__SetPixelFormat@12 referenced in function __glfwCreateContextWGL
glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp__SwapBuffers@4 referenced in function _swapBuffersWGL
MSVCRT.lib(_chandler4gs_.obj) : error LNK2019: unresolved external symbol __except_handler4_common referenced in function __except_handler4
a.exe : fatal error LNK1120: 92 unresolved externals
clang++.exe: error: linker command failed with exit code 1120 (use -v to see invocation)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

莫相离 2025-02-02 19:38:35

让我们向您展示算法。

  1. 让我们看到 __ Imp__getRawinputDeviceInfoa 在未解决的符号之间。
  2. Google getRawinputDeviceInfoa
  3. 结果中的第一页是
  4. 打开并将页面滚动到底部。我们看到那里 |库| user32.lib |
  5. 将库添加到命令行: clang ++ .. \ src \*。cpp -l .. \ lib -lglfw3 -lopengl32 -i .. \ include \ include \ -std = c ++ 17 user32.lib
  6. 尝试构建。
  7. 从1到6重复到所有未解决的符号均已固定。

从命令行删除 .. \ src \*。h

Lets demonstrate you the algorithm.

  1. Let we see __imp__GetRawInputDeviceInfoA between unresolved symbols.
  2. Google GetRawInputDeviceInfoA.
  3. First page in results is https://msdn.microsoft.com/en-us/library/windows/desktop/ms645597(v=vs.85).aspx
  4. Open and scroll the page to the bottom. We see there | Library | User32.lib |.
  5. Add the library to the command line: clang++ ..\src\*.cpp -L..\lib -lglfw3 -lopengl32 -I..\include\ -std=c++17 User32.lib
  6. Try to build.
  7. Repeat from 1 till 6 until all unresolved symbols are fixed.

Remove ..\src\*.h from the command line.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文