0

Ok so I have a bit of a weird issue. I downloaded GLFW through the terminal on my Debian WSL. VSCode (and the autocomplete) acknowledged the header files AND the methods exist, even giving the method information on hover. However, GCC does know the header file exists (and does not throw an error when referenced), yet throws errors when I reference the methods included in the header.

Screenshot

Errors thrown:

gcc -o ge all-src/new-src/GameObject.o all-src/new-src/main.o all-src/new-src/V2.o all- 
src/new-src/V3.o -Wall  
all-src/new-src/main.o: In function `main':
main.c:(.text+0x9): undefined reference to `glfwInit'
main.c:(.text+0x18): undefined reference to `glfwWindowHint'
main.c:(.text+0x27): undefined reference to `glfwWindowHint'
main.c:(.text+0x36): undefined reference to `glfwWindowHint'
main.c:(.text+0x57): undefined reference to `glfwCreateWindow'
main.c:(.text+0x78): undefined reference to `glfwTerminate'
main.c:(.text+0x8b): undefined reference to `glfwMakeContextCurrent'
collect2: error: ld returned 1 exit status
Makefile:23: recipe for target 'all' failed
make: *** [all] Error 1
  • 1
    That is a linker error, which means that you aren't linking against the (compiled) library – UnholySheep Mar 11 '22 at 00:38
  • how would one link a library through a makefile to gcc? – Pixelated Lagg Mar 11 '22 at 00:44
  • Your question looks like this one https://stackoverflow.com/questions/69925780/i-get-linker-errors-when-trying-to-compile-my-opengl-project-using-gcc – Alex Nicolaou Mar 11 '22 at 03:59
  • Does this answer your question? [I get linker errors when trying to compile my opengl project using gcc](https://stackoverflow.com/questions/69925780/i-get-linker-errors-when-trying-to-compile-my-opengl-project-using-gcc) – wohlstad Apr 06 '22 at 10:31

0 Answers0