简体   繁体   English

C ++ MsgPack无法编译

[英]C++ MsgPack unable to compile

Am getting the following error when i tried to cmompile the code which uses the library 我尝试cmompile使用该库的代码时遇到以下错误

http://msgpack.org/ , i tried the first example in C++ section ( documentation of library ) http://msgpack.org/ ,我尝试了C ++部分中的第一个示例(库文档)

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 ++版本详细信息..

$ g++ -v Using built-in specs. $ g ++ -v使用内置规范。 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) 目标:i386-redhat-linux配置为:../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线程模型:posix gcc版本4.1.2 20080704(Red Hat 4.1.2-46)

Please try updating your g++ compiler. 请尝试更新您的g ++编译器。 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. 我正在使用g ++版本4.6.3,没有问题。

This one worked for me ... 这个为我工作...

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

@qehgt Thanks a lot :-) @qehgt非常感谢:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM