代码之家  ›  专栏  ›  技术社区  ›  Gi Yeon Shin

对std:_cxx11::basic_字符串的未定义引用

  •  0
  • Gi Yeon Shin  · 技术社区  · 7 年前

    当我命令的时候 make ,我犯了这样的错误:

    filter_block.cc:(.text+0x1c4): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)'
    

    我找到了一些解决这个错误的方法,比如添加 -D_GLIBCXX_USE_CXX11_ABI=0 ,但我不知道如何添加 制作 命令

    这个 Makefile 其内容如下:

    .SUFFIXES: .c .cpp
    CC              = g++ -fopenmp
    CFLAGS          = -c -O2 -Wall -D_I386 -D_UNIX -fPIC -Wno-unused-result -std=c++11 -Wno-sign-compare
    LFLAGS          = -shared -O2 -o
    LIBS            = -llmi -lblas -lboost_regex -lpthread -lleveldb
    

    我怎样才能补充呢 -D_GLIBCXX_USE_cx11_ABI=0 进入 Makefile ?

    *Ubuntu版本=14.04

    *libstdc++版本

    $ /sbin/ldconfig -p | grep stdc++
    libstdc++.so.6 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    

    *gcc版本

    $ gcc --version
    gcc (Ubuntu 5.4.1-2ubuntu1~14.04) 5.4.1 20160904
    

    *ld版本

    $ ld --version
    GNU ld (GNU Binutils for Ubuntu) 2.26.1
    
    0 回复  |  直到 7 年前
    推荐文章