简体   繁体   English

如何将 glfw 库包含到 C++ 项目中?

[英]How do I include the glfw library to a C++ project?

I've downloaded the glfw source from their site but I don't know where to go from there.我已经从他们的网站下载了 glfw 源代码,但我不知道从那里去哪里。 I'm on linux opensuse.我在 linux opensuse 上。

You probably have to compile the code and then start using.您可能必须编译代码,然后才能开始使用。

From Compiling GLFW you get the information below.通过编译 GLFW,您可以获得以下信息。 After that you may follow the quick-guide之后,您可以按照快速指南进行操作

Generating files with the CMake command-line tool To make an in-tree build, enter the root directory of the GLFW source tree (ie not the src subdirectory) and run CMake.使用 CMake 命令行工具生成文件 要进行树内构建,请进入 GLFW 源代码树的根目录(即不是 src 子目录)并运行 CMake。 The current directory is used as target path, while the path provided as an argument is used to find the source tree.当前目录用作目标路径,而作为参数提供的路径用于查找源树。

cd <glfw-root-dir>

cmake .

To make an out-of-tree build, make a directory outside of the source tree, enter it and run CMake with the (relative or absolute) path to the root of the source tree as an argument.要进行树外构建,请在源树之外创建一个目录,输入它并使用源树根目录的(相对或绝对)路径作为参数运行 CMake。

mkdir glfw-build

cd glfw-build

cmake <glfw-root-dir>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM