ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have been trying for days to compile this code and I always get some sort of undefiened reference error and cannot compile as a result. I would like someone to compile the follwing code and send me the project if it compiles.
This project uses the gl,glu,glut libraries I am don't thing you need windows.h all this code does is bring up a window from the console.
Here is a link to the glut libraries (don't want to slow down this server) . click here for glut libraries (win32)
Renderscene is called by glut main loop. Notice I passed that to one of the glut functions.
I am using code blocks as an IDE and minGW as a compiler.
THIS CODE IS OS NUETRAL! AS LONG AS YOU HAVE THE LINUX GLUT LIBRARY.
ALL IT DOES IS OPEN A BLANK WINDOW!
Undefined references is a linking failure. If you get as far as the linking stage (which in your case fails), the program did compile without errors. You should have posted the exact error message concering the undefiend references the linker is outputting. What you need to do is to tell linker which libraries you are using and where those libraries can be found if they are located in directory that is not normally checked by the linker.
Ok sorry for not posting the errors, I was having problems linking to the glut libraries and I just got passed those now I am recieving what seems to be internal library link errors which were not there until the glut problems disapeared. I think it is probably my fault and I probably added an extra argument somewhere I'll look today. Here are the new errors I am recieveing:
Code:
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/libgcc.a(__main.o)(.text+0x4f): undefined reference to `__EH_FRAME_BEGIN__'
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/libgcc.a(__main.o)(.text+0x73): undefined reference to `__EH_FRAME_BEGIN__'
collect2: ld returned 1 exit status
Here the problem seems that the library path is not set and there is a linking error coming up in your case. Just check some way to get through the library path set in windows. I don't know windows, but in linux just set the LD_LIBRARY_PATH variable with path where the glut library resides.
This should work..
Hitesh
Thank you very much for your help I think that the problem was in the arguments that I passed to the linker. I remade the project and only included the libraries that I needed and no other and everything went smooth.
These are the libraries I included:
glut32, opengl32
These are the arguments sent to the linker
-lglut32 -lopengl32
Now all the arguments in caps so there is no confusion as to what I passed use the small ones if you plan to use them.
-LGLUT32 -LOPENGL32
and that is a dash
I had to clarify for other noobs that may come and read this post!!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.