Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
09-12-2014, 04:15 PM
|
#1
|
Member
Registered: Nov 2012
Posts: 98
Rep:
|
openLG error during compiling with g++
I installed openGL using;
yum install mesa-libGL & yum install mesa-libGL-devel
I tried to compile the following code:
------------------------------------------------------------------------
// A Simple OpenGL Project
#include </GL/glu.h>
#include </GL/gl.h>
void Initialize() {
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
int main(int iArgc, char** cppArgv) {
glutInit(&iArgc, cppArgv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(200, 200);
glutCreateWindow("XoaX.net");
Initialize();
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}
-------------------------------------------------
I am getting the follwoiung errors;
[root@rpcztc Downloads]# g++ -W -pedantic -o radmon test.cpp
test.cpp:7:21: error: /GL/glu.h: No such file or directory
test.cpp:8:20: error: /GL/gl.h: No such file or directory
test.cpp: In function 'void Initialize()':
test.cpp:12: error: 'glClearColor' was not declared in this scope
test.cpp:13: error: 'GL_PROJECTION' was not declared in this scope
test.cpp:13: error: 'glMatrixMode' was not declared in this scope
test.cpp:14: error: 'glLoadIdentity' was not declared in this scope
test.cpp:15: error: 'glOrtho' was not declared in this scope
test.cpp: In function 'int main(int, char**)':
test.cpp:19: error: 'glutInit' was not declared in this scope
test.cpp:20: error: 'GLUT_SINGLE' was not declared in this scope
test.cpp:20: error: 'GLUT_RGB' was not declared in this scope
test.cpp:20: error: 'glutInitDisplayMode' was not declared in this scope
test.cpp:21: error: 'glutInitWindowSize' was not declared in this scope
test.cpp:22: error: 'glutInitWindowPosition' was not declared in this scope
test.cpp:23: error: 'glutCreateWindow' was not declared in this scope
test.cpp:25: error: 'Draw' was not declared in this scope
test.cpp:25: error: 'glutDisplayFunc' was not declared in this scope
test.cpp:26: error: 'glutMainLoop' was not declared in this scope
I look at the /usr/include/GL and I am able to see the glu.h header!
Any idea what link is missing?
|
|
|
09-12-2014, 04:35 PM
|
#2
|
Senior Member
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982
|
The includes are wrong use:
Code:
#include <GL/glu.h>
#include <GL/gl.h>
|
|
1 members found this post helpful.
|
09-13-2014, 03:26 PM
|
#3
|
Member
Registered: Nov 2012
Posts: 98
Original Poster
Rep:
|
Quote:
Originally Posted by hnasr2001
I installed openGL using;
yum install mesa-libGL & yum install mesa-libGL-devel
I tried to compile the following code:
------------------------------------------------------------------------
// A Simple OpenGL Project
#include </GL/glu.h>
#include </GL/gl.h>
void Initialize() {
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
int main(int iArgc, char** cppArgv) {
glutInit(&iArgc, cppArgv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(200, 200);
glutCreateWindow("XoaX.net");
Initialize();
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}
-------------------------------------------------
I am getting the follwoiung errors;
[root@rpcztc Downloads]# g++ -W -pedantic -o radmon test.cpp
test.cpp:7:21: error: /GL/glu.h: No such file or directory
test.cpp:8:20: error: /GL/gl.h: No such file or directory
test.cpp: In function 'void Initialize()':
test.cpp:12: error: 'glClearColor' was not declared in this scope
test.cpp:13: error: 'GL_PROJECTION' was not declared in this scope
test.cpp:13: error: 'glMatrixMode' was not declared in this scope
test.cpp:14: error: 'glLoadIdentity' was not declared in this scope
test.cpp:15: error: 'glOrtho' was not declared in this scope
test.cpp: In function 'int main(int, char**)':
test.cpp:19: error: 'glutInit' was not declared in this scope
test.cpp:20: error: 'GLUT_SINGLE' was not declared in this scope
test.cpp:20: error: 'GLUT_RGB' was not declared in this scope
test.cpp:20: error: 'glutInitDisplayMode' was not declared in this scope
test.cpp:21: error: 'glutInitWindowSize' was not declared in this scope
test.cpp:22: error: 'glutInitWindowPosition' was not declared in this scope
test.cpp:23: error: 'glutCreateWindow' was not declared in this scope
test.cpp:25: error: 'Draw' was not declared in this scope
test.cpp:25: error: 'glutDisplayFunc' was not declared in this scope
test.cpp:26: error: 'glutMainLoop' was not declared in this scope
I look at the /usr/include/GL and I am able to see the glu.h header!
Any idea what link is missing?
|
I made the changes to the header path;
#include <GL/glu.h>
#include <GL/gl.h>
Still I am getting the same error!!
|
|
|
09-13-2014, 04:50 PM
|
#4
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
Quote:
I installed openGL ...
yum install mesa-libGL & yum install mesa-libGL-devel
|
You are missing some packages : *GLU-devel, *glut-devel ...
# yum install mesa-libGLU-devel freeglut-devel
|
|
|
09-13-2014, 06:18 PM
|
#5
|
Member
Registered: Nov 2012
Posts: 98
Original Poster
Rep:
|
I had installed mesa-libGL-devel;
The errors are;
[root@localhost Desktop]# g++ -W -pedantic -o radmon test.cpp
test.cpp:1:20: error: GL/glu.h: No such file or directory
test.cpp: In function int main(int, char**):
test.cpp:13: error: glutInit was not declared in this scope
test.cpp:14: error: GLUT_SINGLE was not declared in this scope
test.cpp:14: error: GLUT_RGB was not declared in this scope
test.cpp:14: error: glutInitDisplayMode was not declared in this scope
test.cpp:15: error: glutInitWindowSize was not declared in this scope
test.cpp:16: error: glutInitWindowPosition was not declared in this scope
test.cpp:17: error: glutCreateWindow was not declared in this scope
test.cpp:19: error: Draw was not declared in this scope
test.cpp:19: error: glutDisplayFun was not declared in this scope
test.cpp:20: error: glutMainLoop was not declared in this scope
|
|
|
09-13-2014, 06:30 PM
|
#6
|
Senior Member
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982
|
Now install libGLU-devel and you should be good to go.
|
|
|
09-14-2014, 02:52 AM
|
#7
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
Ref. #5.
Read post #4 : # yum install mesa-libGLU-devel freeglut-devel
|
|
|
09-14-2014, 02:23 PM
|
#8
|
Member
Registered: Nov 2012
Posts: 98
Original Poster
Rep:
|
To knudfl and metaschima;
As you can see below, I had installed both of the packages you were referring to and still I am getting error!!
[root@localhost ~]# yum install freeglut-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: centos.mirror.rafal.ca
* extras: centos.mirror.rafal.ca
* updates: centos.cubiculestudio.com
Setting up Install Process
Package freeglut-devel-2.4.0-7.1.el5.i386 already installed and latest version
Nothing to do
[root@localhost ~]# yum install libGLU-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: centos.mirror.rafal.ca
* extras: centos.mirror.rafal.ca
* updates: centos.cubiculestudio.com
Setting up Install Process
Package mesa-libGLU-devel-6.5.1-7.11.el5_9.i386 already installed and latest version
Nothing to do
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd Desktop/
[root@localhost Desktop]# ls
C++ eclipse test.cpp test.cpp~ test.sh test.sh~ Unsaved Document 1
[root@localhost Desktop]# g++ test.cpp -o radmon
test.cpp: In function ‘int main(int, char**)’:
test.cpp:13: error: ‘glutInit’ was not declared in this scope
test.cpp:14: error: ‘GLUT_SINGLE’ was not declared in this scope
test.cpp:14: error: ‘GLUT_RGB’ was not declared in this scope
test.cpp:14: error: ‘glutInitDisplayMode’ was not declared in this scope
test.cpp:15: error: ‘glutInitWindowSize’ was not declared in this scope
test.cpp:16: error: ‘glutInitWindowPosition’ was not declared in this scope
test.cpp:17: error: ‘glutCreateWindow’ was not declared in this scope
test.cpp:19: error: ‘Draw’ was not declared in this scope
test.cpp:19: error: ‘glutDisplayFunc’ was not declared in this scope
test.cpp:20: error: ‘glutMainLoop’ was not declared in this scope
|
|
|
09-14-2014, 03:08 PM
|
#9
|
Senior Member
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982
|
You seem to be using GLUT functions without including the header, so add:
Code:
#include <GL/glut.h>
|
|
1 members found this post helpful.
|
09-14-2014, 05:20 PM
|
#10
|
Member
Registered: Nov 2012
Posts: 98
Original Poster
Rep:
|
Thanks adding #include <GL/glut.h> was indeed the problem.
Do you know if the openGL is an easy tool to design drop down menu in c++?
Last edited by hnasr2001; 09-14-2014 at 06:19 PM.
|
|
|
All times are GMT -5. The time now is 10:52 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|