title: Linker error : undefined reference to `std::ctype<char>::_M_widen_init() from static lib. even with same gcc version
body: <p>I am getting error which can be seen below, error is coming from a static library which I created(libredis.a) : </p>
  
  <pre><code>/root/projects/lib/libredis.a(redisHandler.o): In function redisHandler.cpp:(.text+0x1394): undefined reference to `std::ctype&lt;char&gt;::_M_widen_init() const'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>I am 100% positive this static lib and my project are being built with same g++ version(g++46)
  and I used -std=c++0x -static-libstdc++ -static-libgcc options for both them in my makefile.</p>
  
  <p>Here is the gcc output of the problem from project sorry for details :</p>
  
  <pre><code>g++46 common/config.o common/hash.o sighandler.o globals.o itap.o itapworker.o itapdb.o itapmsgs.o itapflow.o itapintercept.o itapstore.o itapipdr.o itaputil.o itapprotoutil.o itapmail.o itapdns.o itapdhcp.o itapradius.o itapdhcpv6.o itapsyslog.o itaprbli.o itapl2tp.o itapsip.o itapisup.o itaprudp.o itapmgcp.o itapmegaco.o itapm3ua.o itapq850codes.o itaph323.o itaprtp.o itapsdp.o itaprtpstatictypes.o itapmsn.o itapymsg.o itapftp.o itapsmtp.o itapimap.o itappop3.o itapsmpp.o itaphttp.o itaphttpproto.o itaphotmail.o itapyahoomail.o itapgmail.o itapfacebook.o itaplinkedin.o itaptwitter.o itaptac.o -o inseptrad  -L/root/projects/lib -L/usr/local/lib -L/usr/lib -lecrypt -lipcutil -lsurlicense -lsysctl -ltcpip -ldpi -lconf -ltimerq -lsqlite -lasn -lmiscutil -lredis -lpcap -lssl -lcrypto -lglib-2.0 -lxml2 -lopal -lm -lrt -lsqlite3 -lpthread -licc -lpgm-5-1-117-pic -lwiro -lwireshark -lwsutil -lpt_r -lboost_system -lhiredis `pkg-config --libs glib-2.0` -O3  -Wall -Wno-unused-function -std=c++0x -DFREEBSD -DINTEL -D__USE_BSD=1 -D__FAVOR_BSD=1 -D__USE_GNU -static-libstdc++ -static-libgcc   -I./include -I./common/include -I/root/projects/include -I/root/projects/include/wiro -I/usr/local/include/libxml2 -I/usr/include/libxml2 -I/usr/local/include/pgm-5.1 -I/usr/include/pgm-5.1 -I/usr/local/include/opal -I/usr/include/opal/ -I/usr/local/lib/gcc46/include/ -I/usr/include/hiredis -I/usr/local/include -I/usr/include `pkg-config --cflags glib-2.0`
  /root/projects/lib/libredis.a(redisHandler.o): In function `redisHandler::alarmCreater(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, std::vector&lt;std::pair&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, boost::any&gt;, std::allocator&lt;std::pair&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, boost::any&gt; &gt; &gt;*, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)':
  redisHandler.cpp:(.text+0x1394): undefined reference to `std::ctype&lt;char&gt;::_M_widen_init() const'
  collect2: ld returned 1 exit status
  gmake: *** [inseptrad] Error 1
  </code></pre>
  
  <p>And also gcc output when I built static library </p>
  
  <pre><code>[root@ ~/projects/test]# gmake clean all install
  mkdir -p /root/projects/lib     &amp;&amp; cd /root/projects/lib;     rm -f libredis.a;                   cd -
  mkdir -p /root/projects/include &amp;&amp; cd /root/projects/include; rm -f redisHandler.hpp; cd -
  rm -f libredis.a *.o *~ *core*
  g++46 -O3 -pipe -fno-strict-aliasing -Winline -Wall -Wno-unused-function -std=c++0x -DFREEBSD -DINTEL -D__USE_GNU -D__USE_BSD=1 -D__FAVOR_BSD=1 -static-libstdc++ -static-libgcc   -I/usr/local/include/glib-2.0 -I/usr/local/include -I/usr/include/hiredis -I/usr/local/lib/gcc46/include/ -I./include/ -I. -I/root/projects/include -I/usr/local/include -I/usr/include `pkg-config --cflags glib-2.0`   -c -o redisHandler.o redisHandler.cpp
  ar scru libredis.a redisHandler.o
  mkdir -p /root/projects/lib     &amp;&amp; cp -pf libredis.a /root/projects/lib
  mkdir -p /root/projects/include &amp;&amp; cp -pf include/redisHandler.hpp  /root/projects/include
  </code></pre>
  
  <p>I can't find any reason why this error might occur , if you guys have some ideas I will be very thankful.  </p>
  
  <p>Ps: Please guys don't close the question the other topic is not helpful for this problem . </p>