about to rip my hair out with boost...

closed account (Dy7SLyTq)
so im writing a lexer, and i want to use boost::regex for it. im sure im using it right (just in case though)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    while(!this->Source.empty())
    {
        if(regex_search(Start, End, Match, regex("\"[^\"]*\""), Flags))
        {
            this->SymbolTable->PushBack("STRING", string(Match[0].first, Match[0].second), 0, -1);
            this->SymbolTable->Next();
            Start = Match[0].second;
            Flags |= match_prev_avail;
            Flags |= match_not_bob;
            continue;
        }

        else if(regex_search(Start, End, Match, regex("[_A-Za-z]+[_A-Za-z0-9]*"), Flags))
        {
            this->SymbolTable->PushBack("STRING", string(Match[0].first, Match[0].second), 0, -1);
            this->SymbolTable->Next();
            Start = Match[0].second;
            Flags |= match_prev_avail;
            Flags |= match_not_bob;
            continue;
        }

    }

someone told me to download the latest source and build that so i did, by unzipping it, cding to the source, running ./bootstrap.sh, ./b2, and finally ./b2 install. when i compile i get no errors but when i run it i get ./jade: error while loading shared libraries: libboost_regex.so.1.55.0: cannot open shared object file: No such file or directory
Sorry, just a dumb question... what did you set the installation prefix to? Boost defaults to /usr/local, which I believe is write-protected. Also, are you sure that your system checks that installation prefix for shared libraries?

Also, another question. I take it you're using a Linux distro, right? If so, is there any particular reason you're not using a package? That could simplify a lot of your headaches.

-Albatross
closed account (Dy7SLyTq)
i didnt specify, however i ran all with and without root (which i know isnt a good idea but i wanted it installed)

Also, are you sure that your system checks that installation prefix for shared libraries?

im sorry i dont know what that means

Also, another question. I take it you're using a Linux distro, right? If so, is there any particular reason you're not using a package?
because i think it was like version 1.45 on the repository which is apparently very old. someone recommended building from source to use the current version
Did you run ldconfig?
closed account (Dy7SLyTq)
god damn it. i forgot to do that last time too
closed account (Dy7SLyTq)
thanks that worked. now if you would be willing to help me one last time so i dont have to waste forum space with a new thread. so im using the function above and need to shorten the string everytime it finds a match to [end of match (ie Match[0].second) : end of string (ie string::size() -1) how would i do that?
I don't really know regex well, but my guess would be something like
1
2
3
4
std::string original;
//execute regex on original
...
std::string newstr(Match[0].second, original.end());
which may work if Match[0].second is an iterator pointing to original.
Last edited on
Topic archived. No new replies allowed.