0

Am getting the following error when i tried to cmompile the code which uses the library

http://msgpack.org/ , i tried the first example in C++ section ( documentation of library )

g++ hello.cc -lmsgpack -o hello

/usr/local/lib/libmsgpack.so: undefined reference to `__sync_sub_and_fetch_4'

Any help is appreciable ..

g++ version details ..

$ g++ -v Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux Thread model: posix gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)

Akhil Thayyil
  • 9,263
  • 6
  • 34
  • 48

2 Answers2

0

Please try updating your g++ compiler. Such error suggests that your compiler is too old and the code you are trying to compile is too new for it.

I am using g++ version 4.6.3 and there are no problems.

Lyubomir Vasilev
  • 3,000
  • 17
  • 24
0

This one worked for me ...

Update your GCC tool-chain. Or try to add -march=pentium or -march=i486, etc.

@qehgt Thanks a lot :-)

Akhil Thayyil
  • 9,263
  • 6
  • 34
  • 48