tr1 undefined reference std::tr1::basic_regex in external library

727 Views Asked by At

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.

0

There are 0 best solutions below