Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22237

C++ Boost undefined reference to `boost::filesystem::path::m_normalize()'

$
0
0

I am trying to compile a program called UKB (https://github.com/asoroa/ukb), but I am facing problems in compilation that I cannot solve:

When I execute make it returns

g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o common.o -I /usr/include common.cc
3.2.7.g7f3a305
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o globalVars.o -I /usr/include globalVars.cc
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o ukbServer.o -I /usr/include ukbServer.cc
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o configFile.o -I /usr/include configFile.cc
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o fileElem.o -I /usr/include fileElem.cc
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o kbGraph.o -I /usr/include kbGraph.cc
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o kbGraph_common.o -I /usr/include kbGraph_common.cc
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o kbGraph_v16.o -I /usr/include kbGraph_v16.cc
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o disambGraph.o -I /usr/include disambGraph.cc
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o csentence.o -I /usr/include csentence.cc
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o wdict.o -I /usr/include wdict.cc
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o walkandprint.o -I /usr/include walkandprint.cc
g++ -O2 -Wall -Wno-deprecated -D UKB_SERVER -o ukb_walkandprint ukb_walkandprint.cc common.o globalVars.o ukbServer.o configFile.o fileElem.o kbGraph.o kbGraph_common.o kbGraph_v16.o disambGraph.o csentence.o wdict.o walkandprint.o -I /usr/include  -lboost_program_options -lboost_system -lboost_filesystem -lboost_random -lpthread
fileElem.o: In function `ukb::File_elem::fill(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
fileElem.cc:(.text+0x364): undefined reference to `boost::filesystem::path::m_normalize()'
collect2: error: ld returned 1 exit status
Makefile:43: recipe for target 'ukb_walkandprint' failed
make: *** [ukb_walkandprint] Error 1

Then when I look at the fileElem.cc it shows (just showing necessary parts of the file)

Header:

#include "fileElem.h"
#include <iostream>
#include <stdexcept>

// Boost filesystem
#include <boost/version.hpp>

#if (BOOST_VERSION / 100 % 1000 < 48)
#define BOOST_FILESYSTEM_VERSION 2
#endif


#include <boost/filesystem.hpp>

The function where the error occurs:

void File_elem::fill(const string & str) {

        boost::filesystem::path p(str);
        p.normalize();

        path = p.branch_path().string();
        if (path == "") path = ".";

#if (BOOST_VERSION / 100 % 1000 < 48)
        string file_fname = p.leaf(); // name + extension
#else
        string file_fname = p.filename().string(); // name + extension
#endif

        string::const_iterator beg = file_fname.begin();
        string::const_iterator end = file_fname.end();
        string::const_iterator it = find_last(file_fname.begin(), file_fname.end(), '.');

        ext.assign(it, end);
        fname.assign(beg, it); // without extension
    } 

My boost version is 1.65 and I am using Ubuntu 18.04.


Viewing all articles
Browse latest Browse all 22237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>