0
#include <GLFW/glfw3.h>

int main(void) {
  
  Example code from GLFW...

  return 0;
}

Been trying to run this simple OpenGL app using these arguments on Windows 10:

g++ -c src/main.cpp
g++ -o main.o -lglfw3 -lopengl32

but I get the following error message over and over again:

c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status

As you can see I'm using MinGW. I have downloaded GLFW from it's official site, and followed their instructions on copying the files. I've tried linking SDL and what not, but I'm stuck. Any help would be appreciated !

Thank you for your time !

Rabbid76
  • 177,135
  • 25
  • 101
  • 146
  • 1
    You forgot the output file name after `-o`, so `main.o` is treated as the output rather than input. Something like `-o my_program main.o`. *"I've tried linking SDL"* SDL has nothing to do with GLFW? – HolyBlackCat Dec 25 '21 at 16:21

0 Answers0