Hey everyone,
After long time I'm writing on this blog. Hope to keep things up from here onwards but cant promise.
This post is about doing OpenGL programming in codeblocks.
Codeblocks is a C/CPP IDE. Usually opengl c programming is done in this. Our lecturer, Ms. G. S. Makalanda ( Senior Lecturer) B.Sc.(Math)(SL), M.Sc.(Stat)(SL), M.Sc. (Comp. Sci.)(UK), has asked us to install code-blocks in order to do C programming on opengl. Well everyone except me is working on windows pc's. This is my story, problems, solutions I found to overcome to run code successfully on codeblocks.
Codeblocks was in Ubuntu Software center so no problem in installing it. I guess there was opengl installed in default. When I create new opengl project, the sample code runs smoothly. But when I create a new glut project it says,
so I issued
Then I manually went to see /usr directory. In there, was /usr/include directory which contained all header files gcc needs. Among them there was GL directory in that I could find gl.h and glut.h. But in /usr/lib I couldn't find any of gllibs. So I searched and searched on web. Then user :-ToApolytoXaos (in Cyprus) in IRC chat room of codeblocks told me to go through wiki pages of codeblocks. Then as a result I again went to freeglut website and download it manually. Then I unziped the download and compiled & installed the source code of freeglut again through terminal. But still the problem existed.
What I did?
I looked through the unziped folder of freeglut. I found a hidden folder in freeglut/src/.lib inside the sourcecode which contained several compiled c objects and a zip file named libglut.a . I had a hunch "Hey these are the things that codeblocks keep repeating that says missing". So I thought to hack this around rather than solving in conventional way. So I did
End of the post I would like to mention something.
CG/gluttest.o:gluttest.c:function display: error||undefined reference to 'glClear'|
CG/gluttest.o:gluttest.c:function display: error||undefined reference to 'glColor3f'|
CG/gluttest.o:gluttest.c:function display: error||undefined reference to 'glBegin'|
CG/gluttest.o:gluttest.c:function display: error||undefined reference to 'glVertex3f'|
CG/gluttest.o:gluttest.c:function display: error||undefined reference to 'glVertex3f'|
CG/gluttest.o:gluttest.c:function display: error||undefined reference to 'glVertex3f'|
CG/gluttest.o:gluttest.c:function display: error||undefined reference to 'glVertex3f'|
*some more references like same*
like wise gives build error for each gl function. Other guys on windows pc had the same problem but they seems to fix it when they changed glut library. So I did some search and found that I have to install freeglut (linux version of the glut).||=== Build finished: 33 errors, 0 warnings ===|
so I issued
sudo apt-get install freeglut3 freeglut3-devBut still I couldn't create a new glut project in codeblocks. When creating glut project they codeblocks ask for the place that have glut installed (place header files and other libraries are). Usually in linux they are in /usr folder. So when I dirrect it the codeblocks say glut libraries are missing and asked me to try to append '.a' and '.so' to files.
Then I manually went to see /usr directory. In there, was /usr/include directory which contained all header files gcc needs. Among them there was GL directory in that I could find gl.h and glut.h. But in /usr/lib I couldn't find any of gllibs. So I searched and searched on web. Then user :-ToApolytoXaos (in Cyprus) in IRC chat room of codeblocks told me to go through wiki pages of codeblocks. Then as a result I again went to freeglut website and download it manually. Then I unziped the download and compiled & installed the source code of freeglut again through terminal. But still the problem existed.
What I did?
I looked through the unziped folder of freeglut. I found a hidden folder in freeglut/src/.lib inside the sourcecode which contained several compiled c objects and a zip file named libglut.a . I had a hunch "Hey these are the things that codeblocks keep repeating that says missing". So I thought to hack this around rather than solving in conventional way. So I did
sudo cp freeglut/src/.lib/* /usr/libNow problem seems to be solved. I could create a new glut project. But when I tried to run the sample glut program given in code::blocks seems to be giving error
I was so frustrated. Then I went to IRC chat with totally frustrated feeling. Again kindly ToApolytoXaos came to help me. He sugested to install me few libraries. So I issued||=== testing, Debug ===| ld: error||cannot find -lXxf86vm| ||=== Build finished: 1 errors, 0 warnings ===|
sudo apt-get install libxmu-dev libxi-dev
sudo apt-get install libXxf86vm-devThen the sample program ran smoothly. I was so happy. But problems didn't ended there to be honest. I had few typos in my own coding. But again ToApolypto helped me to find those. Finally here I am writing a blog post about this so no one ever will be frustrated as I am.
End of the post I would like to mention something.
"Never give up! If you are with linux, there is always a way! At least you have friends who can help you."
5 comments:
Same thing happened to me. Thanks for the help.
thanks, my problem has been solved :)
thank you brother ...Finally I can solved my problem ... greetings from mexico
That's exactly my problem. Thank you so much
Here, in January 2020, and still this same problem is not resolved. I cannot get free-glut working with Ubuntu - Codeblocks. I'm at the point of just going back to Windows so I can write my programs and be done with it.
Post a Comment