0

I am trying to compile a application that use a external library which i don't have the source code, only the headers.

The errors I have are the following:

./libExternal.so: undefined reference to `bool std::tr1::regex_match<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<std::tr1::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > >, char, std::tr1::regex_traits<char> >(__gnu_cxx::__normal_iterator<char const*, std::string>, __gnu_cxx::__normal_iterator<char const*, std::string>, std::tr1::match_results<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<std::tr1::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > > >&, std::tr1::basic_regex<char, std::tr1::regex_traits<char> > const&, std::bitset<11ul>)'
./libExternal.so: undefined reference to `std::tr1::basic_regex<char, std::tr1::regex_traits<char> >::_M_compile()'

I think is something with the version of my gcc but I try and older one without solving the problem. Currently i am using:

gcc version 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC) 

I try to change the std, with the -std flag without solving the problem. I also try to import the boost libraries that implements tr1 but no way...

I am ussing the flowwing makefile:

PROGRAM = tmv

INCLUDEDIRS = -I . \
-I /usr/include/boost  \
-I /usr/include/boost/tr1/tr1  \
-I /usr/include/boost/tr1 \

LIBDIRS = -L .
LIBS =   -lboost_system  -lboost_regex  -pthread  -lExternal
LDFLAGS = $(LIBDIRS) $(LIBS)

CXXSOURCES = *.cpp
CXXFLAGS = -g -Wall -v $(INCLUDEDIRS) 
CXX = g++

all: $(PROGRAM)
$(PROGRAM): $(CXXSOURCES)
    $(CXX) $(CXXSOURCES)  -o $(PROGRAM) $(CXXFLAGS) $(LDFLAGS)
clean:
   $(RM) -f $(PROGRAM) *.o

If anyone have an idea it will be nice. Thank you so much.

FCS
  • 1
  • 1
  • in gcc 5.3 `regex_match` is part of `std`. I am not sure if they would remove it from `tr1` or not since it was standardized. – NathanOliver May 16 '16 at 19:20
  • 3
    [`std::tr1::regex` was never functional.](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43241) The stub implementations have been removed a long time ago. The bits of your library that are using it cannot ever have worked. I'm not sure what the best approach would be to at least get the rest of your library working though. –  May 16 '16 at 19:25
  • What does your _link_ line look like ? And you are probably using the wrong headers. And _boost_ uses it's own namespace in it's headers, that have nothing to do with tr1 (that I know of). –  May 16 '16 at 19:41
  • I edited the question to include the makefile. – FCS May 16 '16 at 20:12

0 Answers0