Advertisement

Compiling problems...

Started by June 27, 2004 05:46 AM
3 comments, last by henrym 20 years, 3 months ago
Recently, I've switched to Gentoo Linux as my operating system of choice. Everything is going good, I've settled in quite nicely, except for development. I copied over my source from a project I was working on while in Windows.. made a KDevelop project and then tried to compile. I get some really wierd errors - I'm not actually including cmath explicitly, it seems to be included when i use iostream:

compiling cmds.cpp (g++) 
*compiling -fPIC (g++) 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:107: error: ` acosf' not declared 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:110: error: ` asinf' not declared 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:113: error: ` atanf' not declared 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:116: error: ` atan2f' not declared 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:119: error: ` ceilf' not declared 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:122: error: ` coshf' not declared 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:125: error: `expf ' not declared 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:128: error: ` floorf' not declared 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:131: error: ` fmodf' not declared 
...snip...
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:564: error: `:: tanl' undeclared (first use here) 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:570: error: `tanh ' not declared 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:574: error: ` tanhf' undeclared in namespace `__gnu_cxx::__c99_binding' 
*/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/cmath:582: error: `:: tanhl' undeclared (first use here) 
Any idea what could be wrong? I am able to compile a simple "hello, world" project without error, and also, pretty much everything on my system has been compiled from sources. Any ideas? Thanks, Henrym
Did you remember to set the namespace correctly? The cmath header should put all that stuff in the std namespace, so you'd either have to use ::cosf() etc. or put "using namespace std;" on top of the source.

Edit: and yould you please truncate the longer lines a little or use a source-tag? The message is a bit too wide.
Advertisement
Quote: Original post by Shadowdancer
Did you remember to set the namespace correctly? The cmath header should put all that stuff in the std namespace, so you'd either have to use ::cosf() etc. or put "using namespace std;" on top of the source.

Like I said, I don't use cmath explicitly, it is being included by iostream:
*In file included from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/bits/locale_facets.tcc:41, *from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/locale:47, *from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/bits/ostream.tcc:37, *from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/ostream:535, *from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/iostream:45, *from /home/henrym/barrelshot/src/cmds.h:4, *from /home/henrym/barrelshot/src/cmds.cpp:1:...errors...

I am using std:: for any calls to iostream objects though. I'm thinking it may be the way my KDevelop project is set up, I'm new to this, is there any include directories I need to set or something?

Quote: Original post by Shadowdancer
Edit: and yould you please truncate the longer lines a little or use a source-tag? The message is a bit too wide.

Done. :)
Try naming your file with a .cc extension. I've had lots of problems trying to use a .cpp extension. Also, to test if its your KDevelop setup which is, in fact, causing the problem, try compiling from the source directly. Try
g++ cmds.cpp -c -o cmds.o
and see if that works. Or, if the entire program is one file, then just
g++ cmds.cpp -o cmds
Also, what optimizations are you using? KDevelop should pick up your CFLAGS and CXXFLAGS since it uses standard Makefiles.
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
Thanks for the reply, after trying both your ideas (no dice!), I ended up installing STLport and using that instead, everything seemed to work fine after that.

Thanks everyone. Now I'm off to code :)

This topic is closed to new replies.

Advertisement