The process of creating a simple GLFW test program (Question)

OK - I also encountered these problems, but found a fix.

  1. I’m using the 32bit version of MinGW. I can tell this as I see mingw32 in the output and not mingw64 (add -v to command line for verbose output from g++ if you don’t see which version your using). Thus I used the libs from glfw-3.1.2.bin.WIN32\lib-mingw
  2. I removed the iostream include and using namespace as you don’t need them for this.
  3. I compiled Main.cpp to Main.o using g++ -c -I. Main.cpp
  4. I linked using: g++ -o Main.exe Main.o -L. -lglfw3 -lopengl32 -lgdi32

Basically there seems to be a problem with compiling and linking on one command line, not sure why (it’s been 15 years since I regularily used unix and I’ve never used MinGW).

Note that I used -I. and -L. to set the compile and link directories as g++ didn’t default to the current dir as I expected.

Hope this helps.