I am very new to OpenGL (and standalone C++) and I am trying my hardest to get anything to work.
After writing some basic code to draw a rectangle on screen, I learned I need a library loader to do basically anything (like compile shaders). So, I downloaded and installed GLFW.
However, I cannot for the life of me get GLFW to link. My setup here is pretty simple:
glfw3.dll
is inMinGW32/bin
libglfw3.a
andlibglfwdll.a
are inMinGW32/lib
- Linker:
-static-libstdc++ -static-libgcc -lglfw3 -lglfw3dll -lopengl32 -lglu32 -lglut32
(I have also tried different permutations of this, none work!)
GLUT, GLU, and OpenGL are installed in a similar manner, and all work (tested using immediate mode OpenGL).
Here is my extremely barebones program:
//GLFW_STATIC also does not work, and I do not know the difference!
#define GLFW_DLL
#include <GLFW/glfw3.h>
int main(int argc, char** argv){
if(!glfwInit())return 0;
GLFWwindow* window = glfwCreateWindow(640,480,"Hello, World!",NULL,NULL);
}
And the link error:
C:\Users\...\AppData\Local\Temp\ccqpeeBm.o:Untitled1.cpp:(.text+0xf): undefined reference to `_imp__glfwInit'
C:\Users\...\AppData\Local\Temp\ccqpeeBm.o:Untitled1.cpp:(.text+0x4d): undefined reference to `_imp__glfwCreateWindow'
c:/program files (x86)/dev-cpp/mingw32/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: C:\Users\..\AppData\Local\Temp\ccqpeeBm.o: bad reloc address 0x20 in section `.eh_frame'
I have looked at other questions regarding this topic, and tried their solutions as best I could. But alas, no luck....
I am using Dev-C++ as the environment.
Any help on this topic is greatly appreciated! I have been trying for months to get OpenGL working, and this is the closest I've been!!