Linux - SoftwareThis 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.
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.
i have openGL installed on my FC6 system , i have the header files installed in the standard /usr/include/GL directory , but when i run programs , the gcc compiler does not reecognise the functions which are defined in these header files
the header files i have included are :
i have also tried setting the LD_LIBRARY_PATH variable but of no use , the problem still persists after doin tat !
please help , .
thanks in advance !
these were the errors shown ,
/tmp/ccOpyBLn.o: In function `Transform':
sam.c.text+0x49): undefined reference to `glViewport'
sam.c.text+0x55): undefined reference to `glMatrixMode'
sam.c.text+0x5a): undefined reference to `glLoadIdentity'
sam.c.text+0x86): undefined reference to `gluPerspective'
sam.c.text+0x92): undefined reference to `glMatrixMode'
there is no use even when i run the ldconfig command , can u suggest anything else?
this is the other set of errors , i did not postthem above due to lack of space !
/tmp/ccOpyBLn.o: In function `main':
sam.c.text+0x118): undefined reference to `glutInit'
sam.c.text+0x124): undefined reference to `glutInitDisplayMode'
sam.c.text+0x138): undefined reference to `glutInitWindowSize'
sam.c.text+0x14c): undefined reference to `glutInitWindowPosition'
sam.c.text+0x158): undefined reference to `glutCreateWindow'
sam.c.text+0x17f): undefined reference to `glutDisplayFunc'
sam.c.text+0x184): undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
Open Graphics Library is an external package (with respect to glibc, gcc, and all core GNU/Linux system). So gcc will never know it should be used in any quality unless you specify it. It installs its header where gcc looks for them by default, but no libraries are linked in unless they are specified or it is libc. So specify '-lGL -lGLU ' to let gcc know you want it to use libGL.so and linGLU.so .
it worked and gave the output( that is a a.out file was created) , but when i run the output it gives the following error # ./a.out
./a.out: error while loading shared libraries: libglut.so.3: cannot open shared object file: No such file or directory
now what does this mean , the compiler is able to find the libraries but not machine ??
No. Not with just gcc. There is a solution - to use 'make'. In simple cases you can write script that does compilation and place it near code. In complex cases you can use Autotools. You can write a shell script that will run gcc with all libraries you ever use, put it in /usr/bin and call it instead, but it is not very good as your programs will have bigger size and unneeded dependencies.
ya i have done it , just got the required tip from the linux for you magazine ,
i jsut created an alias, using the following command , and alas it works ,....... # alias ggl='g++ -lGL -lGLU -lGLw -lglut'
# echo "alias ggl='g++ -lGL -lGLU -lGLw -lglut'" >> ~//.bashrc
now running the command #ggl sample.cpp
compiles the openGL graphics code in the file sample.cpp......................