LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Please help! (https://www.linuxquestions.org/questions/programming-9/please-help-869494/)

m4h 03-18-2011 05:07 PM

Please help!
 
Hi

I have to use OpenGL for a simple game project and have trouble compiling. I'm currently running Backtrack4 (as the Linux environment for coding) through VirtualBox in Windows7 and I code using C++. I have three problems:

1. The computer I use to do the coding on, doesn't have Internet access so I had to download the mesa-utils using another computer and then installed them manually (copying the appropriate files into the /usr/include/ folders - lib, GL, and share respectively). I'm not sure if I did it correctly, because:

2. When I try to compile I get the following errors:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglut.a when searching for -lglut

/usr/bin/ld: skipping incompatible /usr/lib/../lib/libglut.a when searching for -lglut

/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.3.2/../../../libglut.a when searching for -lglut

/usr/bin/ld: skipping incompatible /usr/lib/libglut.a when searching for -lglut

/usr/bin/ld: cannot find -lglut
collect2: ld returned 1 exit status

So, it seems as if it can't find -lglut...

3. I'm not sure how to compile:
g++ -lGL -lGLU -lglut main.C -o main
OR
gcc -lGL -lGLU -lglut main.C -o main

I know these are probably really stupid questions, but I would greatly appreciate it if someone can help me.

Thank you
m4h

corp769 03-18-2011 05:42 PM

Do you have libglut-devel fully installed?

Sergei Steshenko 03-18-2011 09:35 PM

Quote:

Originally Posted by m4h (Post 4295481)
Hi

I have to use OpenGL for a simple game project and have trouble compiling. I'm currently running Backtrack4 (as the Linux environment for coding) through VirtualBox in Windows7 and I code using C++. I have three problems:

1. The computer I use to do the coding on, doesn't have Internet access so I had to download the mesa-utils using another computer and then installed them manually (copying the appropriate files into the /usr/include/ folders - lib, GL, and share respectively). I'm not sure if I did it correctly, because:

2. When I try to compile I get the following errors:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/libglut.a when searching for -lglut

/usr/bin/ld: skipping incompatible /usr/lib/../lib/libglut.a when searching for -lglut

/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.3.2/../../../libglut.a when searching for -lglut

/usr/bin/ld: skipping incompatible /usr/lib/libglut.a when searching for -lglut

/usr/bin/ld: cannot find -lglut
collect2: ld returned 1 exit status

So, it seems as if it can't find -lglut...

3. I'm not sure how to compile:
g++ -lGL -lGLU -lglut main.C -o main
OR
gcc -lGL -lGLU -lglut main.C -o main

I know these are probably really stupid questions, but I would greatly appreciate it if someone can help me.

Thank you
m4h

It may be you are running a 64 bit OS, but the libraries you have (the "i486" part) suggests you 32 bit libraries and 64 bit ones.

John VV 03-19-2011 01:02 AM

glut has a VERY LONG and very well documented instructions in the source
for windows
mac
and linux
even for sun

you might want to read them
AND VERY VERY IMPORTANT
CHANGE THE NAME TO SOMETHING USEFUL LIKE
"help with building glut"

m4h 03-19-2011 01:39 AM

corp769, how would I know if I have it fully installed? What files should be where? As I have said, I had to manually copy the files from the mesa-package to their corresponding folders in root/usr. I haven't done anything other than that.

John VV 03-19-2011 03:00 AM

glut
http://www.opengl.org/resources/libr..._downloads.php
in the source are the instructions
and part of them is that YOU have to copy/paste the *.so or *.a into /usr/lib
did you ?
then did you run "ranlib"
and copy /paste the header files ( *.h) into /usr/include/GL

m4h 03-19-2011 04:14 AM

I tried to copy the .so file into usr/lib but it gives an error stating "/usr/lib/libglut.so.3.9.0 does not exist". What should I do about that. Thanks a lot for trying to help me.

knudfl 03-19-2011 07:29 AM

Backtrack 4 is based on Ubuntu 8.10 Intrepid.
If you want to make things easier, then use a supported OS for development.
Ubuntu 8.10 has been unsupported for long time.

Ubuntu 8.10 glut :
freeglut3-dev_2.4.0-6.1_i386.deb freeglut3_2.4.0-6.1ubuntu1_i386.deb
The old archive http://old-releases.ubuntu.com/ubuntu/
> > http://old-releases.ubuntu.com/ubunt...in/f/freeglut/

.

m4h 03-19-2011 11:26 AM

Thanks, I'll try to get the Ubuntu 8.10 glut and see if it works. After many unsuccessful attempts to obtain a distro that has a g++ compiler, Backtrack4 was the only one that had one, that's why I'm using Backtrack and not one of the other OSes.

knudfl 03-19-2011 11:34 AM

Quote:

.. obtain a distro that has a g++ compiler
All Linux OS has at least one g++ compiler, most have two to four
that can be installed at the same time.
Debian, Ubuntu, Mint : package names = g++ and g++-<version>.
Fedora, Mandriva, CentOS : package name = gcc-c++, compat-gcc34-c++.
Suse : package names = gcc-c++, gcc33-c++, gcc41-c++, gcc43-c++, gcc45-c++.

Slackyman 03-19-2011 11:53 AM

Quote:

Originally Posted by knudfl (Post 4296181)
All Linux OS has at least one g++ compiler, most have two to four
that can be installed at the same time.
Debian, Ubuntu, Mint : package names = g++ and g++-<version>.
Fedora, Mandriva, CentOS : package name = gcc-c++, compat-gcc34-c++.
Suse : package names = gcc-c++, gcc33-c++, gcc41-c++, gcc43-c++, gcc45-c++.

Slackware: gcc-g++-4.4.4

knudfl 03-19-2011 12:02 PM

# 11 : Slackware is a good example. All basic development tools / files
are included, when the OS is installed. Ideal, when the OP has no internet.


Using Backtrack for development should be last choice.
Backtrack is meant to be used as a live cd for forensics only.

..

Sergei Steshenko 03-19-2011 03:02 PM

Quote:

Originally Posted by m4h (Post 4295889)
I tried to copy the .so file into usr/lib but it gives an error stating "/usr/lib/libglut.so.3.9.0 does not exist". What should I do about that. Thanks a lot for trying to help me.

You are doing it wrong - .so files are typically symbolic links.

Start from

http://www.yolinux.com/TUTORIALS/Lib...ndDynamic.html
http://www.faqs.org/docs/Linux-HOWTO...ary-HOWTO.html
http://linux.org/docs/ldp/howto/Prog...WTO/index.html

and, anyway, better use your distro package manager.

m4h 03-22-2011 12:18 AM

Okay, thanks. I'll see if I can maybe get another OS installed and will use the links Sergei gave. Thanks again! Hope that everything is sorted out when I post here again.


All times are GMT -5. The time now is 07:32 AM.