0

I want to start using Boost libs in my code, so I downloaded the lib and I set them on my C drive that C:\Boost\1.67.0\MSVC\2013. I followed their Getting Started on Windows tuto everything it set up.

On Qt Creator I create a new project inside the .pro the file I had added the link to the libs repository like so

INCLUDEPATH += C:/Boost/1.67.0/MSVC/2013
LIBS += C:/Boost/1.67.0/MSVC/2013/stage/lib  

So the final step is to test Boost with the simple test code they provided

#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;
    }
}

However, I got this linking error though

error: LNK1181: cannot open input file 'C:\Boost\1.67.0\MSVC\2013\stage\lib.obj'

I don't know where did I miss it?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
cht_usr
  • 119
  • 1
  • 8
  • You noticed that `C:/Boost/1.67.0/MSVC/2013/stage/lib` is a directory, and `LIBS ` want's to see particular library files from there? – πάντα ῥεῖ Jul 14 '18 at 11:05
  • Yes, this variable normaly should contain a list of libraries to be linked into the project – cht_usr Jul 14 '18 at 11:11
  • So why don't you provide a list of those library files there? – πάντα ῥεῖ Jul 14 '18 at 11:22
  • I think by setting the path of the lib directory, there is no need to add list of libs – cht_usr Jul 14 '18 at 11:37
  • Obviously not. There is another variable that takes the library paths. – πάντα ῥεῖ Jul 14 '18 at 11:40
  • this question is not duplicate !!!, it a speciale case – cht_usr Jul 14 '18 at 11:55
  • If you read the answers there thoroughly, you'll find how to solve your problem. There's nothing special with boost libraries regarding any other libraries. – πάντα ῥεῖ Jul 14 '18 at 11:56
  • I tried to add the lib `LIBS += C:/Boost/1.67.0/MSVC/2013/stage/lib/libboost_regex-vc120-mt-x32-1_67.lib`, then I got another error `LNK1104: cannot open file 'libboost_regex-vc120-mt-x64-1_67.lib'`, however, this file exist already – cht_usr Jul 14 '18 at 11:58
  • I had added the correct path is [solution](https://stackoverflow.com/questions/24715864/problems-importing-libraries-to-my-c-project-how-to-fix-this) do not work for me, so this question is not duplicate plz demarked it – cht_usr Jul 14 '18 at 12:03
  • go to the `C:/Boost/1.67.0/MSVC/2013/stage/lib` repo check if you have .dll files, if no, so you've missed the configuration check [this](https://stackoverflow.com/questions/2629421/how-to-use-boost-in-visual-studio-2010/2655683#2655683) out. – azdoud Jul 14 '18 at 12:44
  • 1
    I think that was the problem, thank you :) – cht_usr Jul 14 '18 at 12:48

0 Answers0