SFML community forums

Help => General => Topic started by: HedgeMan on May 07, 2010, 01:10:18 pm

Title: [FIXED]undefined reference `std::ctype<char>::_M_widen
Post by: HedgeMan on May 07, 2010, 01:10:18 pm
Hi SFMLers,

I'm getting the following error message when compiling the clock-example from "Tutorial - Getting started - SFML and gcc (Linux)" (http://www.sfml-dev.org/tutorials/1.6/start-linux.php) on gNewSense:

Code: [Select]
> g++ -c clock.cpp
> g++ -o clock clock.o -lsfml-system
/usr/local/lib/libsfml-system.so: undefined reference to `std::ctype<char>::_M_widen_init() const@GLIBCXX_3.4.11'
collect2: ld returned 1 exit status


What I've done so far:
-Donwloaded SFML-1.6 to my Desktop
-Unpacked it
- Opened Terminal:
Code: [Select]
> sudo make install
[sudo] password for userXY:
make[1]: Entering directory `/home/userXY/Desktop/SFML-1.6/src/SFML'
make[2]: Entering directory `/home/userXY/Desktop/SFML-1.6/src/SFML/System'
make[2]: Leaving directory `/home/userXY/Desktop/SFML-1.6/src/SFML/System'
make[2]: Entering directory `/home/userXY/Desktop/SFML-1.6/src/SFML/Window'
make[2]: Leaving directory `/home/userXY/Desktop/SFML-1.6/src/SFML/Window'
make[2]: Entering directory `/home/userXY/Desktop/SFML-1.6/src/SFML/Network'
make[2]: Leaving directory `/home/userXY/Desktop/SFML-1.6/src/SFML/Network'
make[2]: Entering directory `/home/userXY/Desktop/SFML-1.6/src/SFML/Graphics'
make[2]: Leaving directory `/home/userXY/Desktop/SFML-1.6/src/SFML/Graphics'
make[2]: Entering directory `/home/userXY/Desktop/SFML-1.6/src/SFML/Audio'
make[2]: Leaving directory `/home/userXY/Desktop/SFML-1.6/src/SFML/Audio'
make[1]: Leaving directory `/home/userXY/Desktop/SFML-1.6/src/SFML'


My g++-Version:
Code: [Select]
> g++ --version
g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE


Hope you can help me.

Regards,

HedgeMan
Title: [FIXED]undefined reference `std::ctype<char>::_M_widen
Post by: HedgeMan on May 07, 2010, 08:10:36 pm
Seems that I don't have the correct version of libstdc++:

Code: [Select]
> strings /usr/lib/libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBC_2.3
GLIBC_2.0
GLIBC_2.4
GLIBC_2.1
GLIBC_2.1.3
GLIBC_2.2
GLIBCXX_FORCE_NEW

Any suggestions? Should try to use an older version of SFML or compile SFML by myself (trying to change the c++ standard lib by brute force seems a little dangerous I think 8))?
Title: [FIXED]undefined reference `std::ctype<char>::_M_widen
Post by: Breakman79 on May 07, 2010, 08:40:00 pm
Maybe you can upgrade your libstdc++ library.  

Something like:   apt-get install --reinstall libstdc++6
Title: [FIXED]undefined reference `std::ctype<char>::_M_widen
Post by: HedgeMan on May 07, 2010, 09:59:46 pm
No, just the same... think I'll have to wait until the libs are updated... (I have no idea why sfml is not part of gNewSense)

But thanks for your help!
Title: [FIXED]undefined reference `std::ctype<char>::_M_widen
Post by: Breakman79 on May 07, 2010, 11:12:54 pm
Actually, I believe another solution would be to simply recompile the SFML library on your computer so that is uses your older version of libstdc++
Title: [FIXED]undefined reference `std::ctype<char>::_M_widen
Post by: HedgeMan on May 08, 2010, 12:55:09 am
Quote from: "Breakman79"
Actually, I believe another solution would be to simply recompile the SFML library on your computer so that is uses your older version of libstdc++

Yes, I tried, but there is a problem with the dependencies:

To build SFML, I need the package libglu1-mesa-dev, but when I try to mark it for installation, I get the message:

Code: [Select]
libglu1-mesa-dev:
  dependes on: libglu1-mesa (=7.0.3~rc2-1ubuntu3) but 7.0.3~rc2-1ubuntu3gnewsense3 is to be installed


so if I try to remove libglu1-mesa there is a long list of packages/programs that will be also removed.

So if I try make, I get the following:

Code: [Select]
make[2]: Entering directory `/home/userXY/Desktop/SFML-1.6/src/SFML/Graphics'
g++ -o Drawable.o -c Drawable.cpp -W -Wall -pedantic -I../../../include -I../../ -O2 -DNDEBUG -fPIC -I/usr/include/freetype2
In file included from ../../SFML/Graphics/GraphicsContext.hpp:33,
                 from Drawable.cpp:29:
../../SFML/Graphics/GLEW/glew.h:1114:20: error: GL/glu.h: No such file or directory

which IMHO is because I can't install libglu1-mesa-dev.

Ah, I had a look at the package-manager... perhaps I can force my gNewSense to use the 7.0.3~rc2-1ubuntu3-version of libglu1-mesa... think I'll give it a try.

If you don't hear from me anymore, you know that this was a bad idea... :twisted:
Title: [FIXED]undefined reference `std::ctype<char>::_M_widen
Post by: HedgeMan on May 08, 2010, 01:15:50 am
Ok, things are working now. :D

After forcing gNewSense to use the 7.0.3~rc2-1ubuntu3-version of libglu1-mesa I was able to install libglu1-mesa-dev and compile SFML as described in the tutorial.

I was able to compile and run the clock program, did a reboot and checked my system for updates: No suspicious messages at any time so everything seems to work fine now (I hope I haven't done something that will crash my system some day suddenly since I'm relative new to gNewSense 8)).

If there are any problems I will post.

Thank you very much for your help, Breakman79!!!
Title: [FIXED]undefined reference `std::ctype<char>::_M_widen
Post by: Breakman79 on May 08, 2010, 02:54:11 am
My pleasure :)  Glad you were able to get it working.
Title: [FIXED]undefined reference `std::ctype<char>::_M_widen
Post by: HedgeMan on May 08, 2010, 01:28:58 pm
Quote from: "Breakman79"
My pleasure :)  Glad you were able to get it working.

It's often the case that you find the solution by explaining someone what you have done so far... :D
Title: package error.
Post by: sasciame on September 16, 2010, 07:50:06 pm
Hello I am experiencing the same problem.  How did you force gNewSense to use the 7.0.3~rc2-1ubuntu3-version of libglu1-mesa?   I also need  to install libglu1-mesa-dev and compile something.