首页 > 解决方案 > 无法让 GLFW 与 g++ 链接

问题描述

好的,所以我正在尝试将 GLFW 链接到链接,但我遇到了麻烦。

这是控制台中的错误:

g++ -Iinclude -Llib -o out/main source/*.cpp
Undefined symbols for architecture x86_64:
  "_glfwInit", referenced from:
      _main in main-779346.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main] Error 1

这是我的生成文件:

compiler = g++

main:
    $(compiler) -Iinclude -Llib -o out/main source/*.cpp
    ./out/main

这是我的文件结构: 在此处输入图像描述

我在 macos 10.15.7 上并使用 Visual Studio Code 作为我的编辑器。希望有人能帮忙!

标签: c++g++glfw

解决方案


推荐阅读