Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
391 views
in Technique[技术] by (71.8m points)

c++ - Linker error: undefined reference to `std::ctype<char>::_M_widen_init()

I am getting linker error while trying to run a sample project. Could you let me know how can I fix this?

Thanks in advance.

make[1]: Entering directory `/home/rumi/MobiusProject/Multiproc-Paper/Transformer/ssg'
/usr/bin/g++ -w -DMOBIUS_LITTLE_ENDIAN -DMOBIUS_LINUX -m32 -o ssgGen_Linux    -L../../lib/Linux_lib/  -L/home/rumi/Mobius/mobius/Mobius-2.3/Cpp/lib/Linux_lib  -L/home/rumi/Mobius/mobius/Mobius-2.3/Cpp/external/lib/Linux -L../../external/lib/Linux -lgenMain -lgen  -lvary_num_compRangeStudy -lmulti_proc_PVPV -lmulti_procRJ -lmemory_moduleSAN -lcpu_moduleSAN -lio_port_moduleSAN -lerrorhandlersSAN   -lTRex -lStudy -lPV -lComposer_RepJoin -lSAN -lbase -lstate -lmobutil -ldist  -lstdc++ -lcrypto -lpthread -lm

make[1]: Leaving directory `/home/rumi/MobiusProject/Multiproc-Paper/Transformer/ssg'
make: Leaving directory `/home/rumi/MobiusProject/Multiproc-Paper/Transformer/ssg'

/home/rumi/Mobius/mobius/Mobius-2.3/Cpp/lib/Linux_lib/libgenMain.a(Main.o): In function `commandline(int, char**, int&, char*&, char*&)':
Main.cpp:(.text+0x494): undefined reference to `std::ctype::_M_widen_init() const'
Main.cpp:(.text+0x4b1): undefined reference to `std::ctype::_M_widen_init() const'
Main.cpp:(.text+0x584): undefined reference to `std::ctype::_M_widen_init() const'
/home/rumi/Mobius/mobius/Mobius-2.3/Cpp/lib/Linux_lib/libgenMain.a(Main.o): In function `main':
Main.cpp:(.text+0x894): undefined reference to `std::ctype::_M_widen_init() const'
Main.cpp:(.text+0x8b4): undefined reference to `std::ctype::_M_widen_init() const'
/home/rumi/Mobius/mobius/Mobius-2.3/Cpp/lib/Linux_lib/libStudy.a(BaseStudyClass.o):BaseStudyClass.cpp:(.text+0x5c4): more undefined references to `std::ctype::_M_widen_init() const' follow
collect2: ld returned 1 exit status
make[1]: *** [exec3] Error 1
make: *** [opt] Error 2

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It looks like it's part of the standard library that's mismatched here. The two most likely answers I can think of:

  • You didn't compile and link the entire project (including all libraries) with the same version of g++.
  • The header/library paths you're using for the standard library mismatch, and you're getting the headers from one library version but the .so library from a different version.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...