On Fri, 15 Aug 2008 00:56:03 GMT
innodes <innodes@no-mx.forums.opensuse.org> wrote:
> /local/downloads/sourcefiles/kooldock/src/xosd.cpp:181:
> error: “abs” was not declared in this scope
This is an issue with the newest gcc/g++. Gcc/g++ was updated recently to
more strongly conform to standards, and some things were “undefaulted” in
the header files, meaning that they are no longer “helpfully” included
from other header files.
This means faster compiling, less issues with double (or triple or more)
loading of included files, and fewer ‘extra’ symbols being included in a
resultant program/library.
Basically, what this means to us as users/compilers is that you need to look
at the “not declared in this scope” error, see what it’s complaining about…
in this cast, “abs”. Now, I know that this is from the stdlib library, but
many may not know that fact… an easy way to find out…
man 3 abs
(brings up the section 3 man page for ‘abs’, section 3 is programming, there
are other sections, if you don’t specify it, you might get a man page for
something that is close, but not what you’re wanting (try ‘printf’ for an
example of this))
The man page states near the top that this is included via the ‘stdlib.h’
header file. That would be for a C file, compiled with gcc… our file
here is ‘xosd.cpp’, a C++ source file, thus we need the C++ version…
drop the ‘.h’, and add ‘c’ to the beginning, so the include file you need is
‘cstdlib’.
edit xosd.cpp and insert the following line near the top (best would be after
all the other #include lines)
#include <cstdlib>
save the file, and rerun ‘make’.
This time it compiles completely, and your next step would be to install it…
sudo make install
===================================
Some things to remember:
Don’t compile things as root. (Actually, don’t do ANYTHING as root unless
there’s no other way. ‘su - root’ or ‘sudo’ are your friends. )
The preferred method to compile a program is thus:
(untar, unzip, whatever to extract files)
cd somedir
…/configure
make
sudo make install
You initially ran ‘make -f Makefile.cvs’, which is a
supplementary/testing-only file. The ‘configure’ script (./configure) will
create appropriate Makefiles after it scans your system to make sure that
needed dependencies are installed. Read the errors it provides, as it tells
you what you need to continue.
If ANY step stops with an error, resolve that error and rerun the step until
it completes successfully. ‘make’ and ‘make install’ are useless unless
‘./configure’ works.
===================================
I used kooldock-0.4.7.tar.bz2 from the kooldock sourceforge site, so the
commands would be:
tar xjf kooldock-0.4.7.tar.bz2
cd kooldock
…/configure
make
{edit src/xosd.cpp and add ‘#include <cstdlib>’}
make
sudo make install
Taa daa!
You’re on your own again for how to USE kooldock… {Grin}
Hope this helps
Loni
–
L R Nix
lornix@lornix.com