1

When I command make, I got errors like this:

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)'

I found some solutions for this error, like adding -D_GLIBCXX_USE_CXX11_ABI=0, but I don't know how to add the command for make command.

The Makefile is written as:

.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

How can I add -D_GLIBCXX_USE_CXX11_ABI=0 into Makefile?

*Ubuntu version = 14.04

*libstdc++ version

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

*gcc version

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

*ld version

$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.26.1
Gi Yeon Shin
  • 357
  • 2
  • 7
  • 19
  • Try to add -D_GLIBCXX_USE_CXX11_ABI=0 to the end of the line of CFLAGS = – Yaroslav Nikitenko Oct 11 '18 at 13:20
  • I add `-D_GLIBCXX_USE_CXX11_ABI=0` to the end of the line of `CFLAGS`, but it doesn't work well. There's same error when I compile – Gi Yeon Shin Oct 12 '18 at 05:53
  • @gi-yeon-shin then probably the problem is not in the Makefile? Please compile the program using only gcc. Also try to use another version of gcc (https://stackoverflow.com/questions/37004976/undefined-reference-to-processstd-cxx11basic-string-when-compiling-a). I think you should localize the problem and make another post with some of your source code. – Yaroslav Nikitenko Oct 12 '18 at 07:36
  • Looks similar to: https://stackoverflow.com/questions/52776046/compiling-error-with-make-command-std-cxx11 is libleveldb compiled with `-D_GLIBCXX_USE_CXX11_ABI=0` too? – Kuchara Oct 12 '18 at 14:06
  • I don't know whether libleveldb is compiled with `D_GLIBCXX_USE_CXX11_ABI=0`, because the file is made by other – Gi Yeon Shin Oct 16 '18 at 02:25
  • But his code works well in his environment, I don't know why the code doesn't work in my environment – Gi Yeon Shin Oct 16 '18 at 02:26
  • I made another post with the source code [link](https://stackoverflow.com/questions/52776046/compiling-error-with-make-command-std-cxx11?noredirect=1#comment92484003_52776046) – Gi Yeon Shin Oct 16 '18 at 02:27

0 Answers0