MinGW is a difficult environment to use for complex programs. Using the free community edition of Visual Studio on Windows can be easier.
Going back to your first error, you didn’t mention the compilation arguments you used, so if you have further issues do make sure to post those along with your error.
You might find my replies in this post useful.
Essentially you need to make sure you include all the required libaries, which can depend on the version of MinGW you are using. Something like the following should work:
g++ mycode.cpp -lglfw3 -lopengl32 -lgdi32 -luser32 -lkernel32
This is the command line example, so for Code Blocks you need to specify those libraries somewhere.
There is a little more information in this article on building applications with GLFW.