我最近一直在尝试编译 C++ 代码并且不依赖于 IDE,我决定使用编辑器和命令行来编写和编译代码。
问题是我想制作一个 glfw 应用程序,但是当我与 glfw3.lib 和 opengl32.lib 链接时出现错误:
a.exe:致命错误 LNK1120:92 未解析的外部
操作系统: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;
}
Run Code Online (Sandbox Code Playgroud)
源代码/窗口.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, …Run Code Online (Sandbox Code Playgroud)