Large number of link errors when cross-compiling OpenGL application for windows
Okay, so here's the situation:
I have an application which uses SDL and OpenGL. I've been developing it in Linux (Ubuntu 10.10), and on that platform it compiles, builds, and runs wi开发者_StackOverflow中文版thout a hitch. I would like to be able to test my application on Windows, and to that end I have been attempting to cross-compile it with the MinGW toolchain. Right now, the application compiles with no warnings, but for the life of me I cannot get it to link the OpenGL libraries correctly. To be specific, I get the following errors a large number of times:
undefined reference to
undefined reference to_glUseProgram@4' undefined reference to
_glDetachShader@8'_glDeleteProgram@4' undefined reference to
_glDeleteShader@4' undefined reference to_glCreateProgram@0' undefined reference to
_glCreateShader@4' undefined reference to_glShaderSource@16' undefined reference to
_glCompileShader@4' undefined reference to_glGetShaderiv@12' undefined reference to
_glGetShaderInfoLog@16' undefined reference to ``_glAttachShader@8' ...and so on
For completeness, the command used to link the application:
i586-mingw32msvc-g++ -Wall -g -DGL_GLEXT_PROTOYPES -o
<output file
><object files
> -Llib/lib -lmingw32 -lSDLmain -lSDL -mwindows -lglu32 -lopengl32 -I./include -I/usr/include -I./lib
Googling has led me to understand that the glu32 and opengl32 libraries only support an early version of OpenGL (like 1.1 or 1.4), and my application uses OpenGL 3.0+ features, so that is my current theory of where the problem is coming from. That being said, I really have no idea how to fix it.
It should be noted that I am very new to software development, so my understanding of how things work is rather shallow at this point.
The issue you're running into is the version and available features, yes. You could, in theory, handle all of the stuff on your own, but I would very much recommend using GLEW to handle extensions and additional features for you (can greatly simplify things). The basics to get started with GLEW are here, and once you have it set up, using additional OpenGL features is quite simple. GLEW also provides some checks to see what is available or verify a particular feature.
精彩评论