mrsimb wrote on Sunday, June 16, 2013:
Hello. I can’t compile a simple program.
#include <GLFW/glfw3.h>
void render();
int main(int argc, char **argv)
{
GLFWwindow* window;
glfwInit();
window=glfwCreateWindow(640, 480, "Test", NULL, NULL);
glfwMakeContextCurrent(window);
while(!glfwWindowShouldClose(window))
{
render();
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
void render()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex2f(-1.0f, 0.0f);
glVertex2f(0.0f, 1.0f);
glVertex2f(1.0f, 0.0f);
glEnd();
}
Mingw shell input:
mingw32-g++ main.cpp -o test.exe -I C:/Programming/GLFW3/include -L C:/Programming/GLFW3/lib-mingw -lmingw32 -lglfw3 -lopengl32
MinGW shell output:
C:/Programming/GLFW3/lib-mingw/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x30a): undefined reference to `_imp__CreateDCW@16'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x356): undefined reference to `_imp__GetDeviceCaps@8'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x3a2): undefined reference to `_imp__DeleteDC@4'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x7b): undefined reference to `_imp__CreateDCW@16'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x91): undefined reference to `_imp__GetDeviceGammaRamp@8'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x9d): undefined reference to `_imp__DeleteDC@4'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x35b): undefined reference to `_imp__CreateDCW@16'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x36d): undefined reference to `_imp__SetDeviceGammaRamp@8'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x379): undefined reference to `_imp__DeleteDC@4'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xeb): undefined reference to `_imp__DescribePixelFormat@16'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x939): undefined reference to `_imp__DescribePixelFormat@16'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xa70): undefined reference to `_imp__DescribePixelFormat@16'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xa92): undefined reference to `_imp__SetPixelFormat@12'
C:/Programming/GLFW3/lib-mingw/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1522): undefined reference to `_imp__SwapBuffers@4'
collect2.exe: error: ld returned 1 exit status