简体   繁体   中英

C++ and boost libraries

I'm trying to get boost set up on my machine as I wish to learn boost as it may be part of the new upcoming C++ standard.

I've ran into a problem (despite the many problems I had trying to build the libraries which now seem to be solved).

After building the libraries they now reside in C:\\MinGW\\lib\\libs and I have folders such as math, system, date_time all populated by .object files .dll's and .a or library files. So I believe I have built the libraries correctly.

I am now stuck trying to link the libraries to my executable by using the following code off of the boost getting started tutorial:

#include <boost/regex.hpp>
#include <iostream>
#include <string>

int main()
{
std::string line;
boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );

while (std::cin)
{
    std::getline(std::cin, line);
    boost::smatch matches;
    if (boost::regex_match(line, matches, pat))
        std::cout << matches[2] << std::endl;
}
}

I am using CodeBlocks and MinGW so I tried linking this program with -llibboost_regex-mgw45-1_47.dll.a which gave me the error that it cannot find the library despite it being present in libs\\regex which is my problem.

Thank you for any and all help and sorry for the newbie question!

Link with the option -lboost_regex . Use -L to specify additional library search paths.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM