c++ - Windows C++ How to install GLFW library?
问题描述
I am coding window part of my game. Code gives error. I think the reason of the error is the lack of GLFW
library. I am using Notepad++
for editing and MinGW
for compiling. How can I install a library to my folder?
Error:
NPP_SAVE: C:\Users\User\Desktop\game\src\main.cpp
CD: C:\Users\User\Desktop\game\src
Current directory: C:\Users\User\Desktop\game\src
g++ "main.cpp" -o main -march=native -O3
Process started (PID=1568) >>>
In file included from main.cpp:4:
Display.h:7:10: fatal error: GLFW/glfw3.h: No such file or directory
#include <GLFW/glfw3.h>
^~~~~~~~~~~~~~
compilation terminated.
<<< Process finished (PID=1568). (Exit code 1)
NPP_RUN: main
; executing: NPP_RUN main
- the specified file was not found
================ READY ================
解决方案
你不需要安装库,你只需要告诉编译器在哪里可以找到你需要的头文件和库。你如何做到这一点取决于你的构建环境。如果您仅使用 mingw g++,则需要以下选项:
-I
(这是一个大写的 i!)(指定包含文件的路径,在你的情况下是 glfw/include 目录的路径)-L
(库的路径,在您的情况下指向包含 glfw3.lib 的文件夹)-l
(这是一个小写的 L!)(要使用的库列表,在您的情况下为 glfw3,不带扩展名)
推荐阅读
- node.js - 安装 git for windows 后 npm run 不起作用
- python - 向列添加多索引
- python - 密码哈希和验证
- excel - 使用用户表单搜索和编辑记录
- r - 将两个整数相除,给出整数商和余数,而不用在 R 中进行除法或乘法
- hadoop - Sqoop 命令在 RDBMS 中删除表
- android - 拒绝对先前失败的类 java.lang.Class 重新初始化
支持库=28 - excel-formula - Excel - 仅使用每行和列一次在表中查找最高和的函数
- angular - agGrid Angular - 在行、列上添加元素(图标)
- amazon-web-services - 如何在 AWS 上连接安装并连接到 GUI SUSE