so I'm using GLFW and VSCode and have written:
#include <GLFW/glfw3.h>
int main(void)
{
GLFWwindow* window;
if (!glfwInit())
return -1;
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
while (!glfwWindowShouldClose(window))
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
I used g++ to compile this and entered g++ main.cpp -o build -Wall -framework OpenGL -L/usr/local/Cellar/glfw/3.3.2/lib And its output was
ld: warning: text-based stub file /System/Library/Frameworks//OpenGL.framework/OpenGL.tbd and library file /System/Library/Frameworks//OpenGL.framework/OpenGL are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.tbd and library file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.tbd and library file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib are out of sync. Falling back to library file for linking.
Undefined symbols for architecture x86_64:
"_glfwCreateWindow", referenced from:
_main in main-2fb2c9.o
"_glfwInit", referenced from:
_main in main-2fb2c9.o
"_glfwMakeContextCurrent", referenced from:
_main in main-2fb2c9.o
"_glfwPollEvents", referenced from:
_main in main-2fb2c9.o
"_glfwSwapBuffers", referenced from:
_main in main-2fb2c9.o
"_glfwTerminate", referenced from:
_main in main-2fb2c9.o
"_glfwWindowShouldClose", referenced from:
_main in main-2fb2c9.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I installed GLFW 3 with homebrew. I'm on macOS High Sierra 10.13.6 And VSCode version: 1.48.2 Commit: a0479759d6e9ea56afa657e454193f72aef85bd0 Date: 2020-08-25T10:09:08.021Z Electron: 7.3.2 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Darwin x64 17.7.0 Thanks in advance!