0

I am back to Qt and C++ programming after a year break. I am trying to install boost library into Qt on Mac (10.9.4) and I am completely confused. This is what I did:

I installed boost using homebrew.

I see that hpp files are installed here:

/usr/local/Cellar/boost/1.55.0_2/include/boost

and libraries here:

/usr/local/Cellar/boost/1.55.0_2/lib

Now I start a new Qt console project.

the project file:

 QT       += core

 QT       -= gui

 TARGET = testQt
 CONFIG   += console
 CONFIG   -= app_bundle

 TEMPLATE = app

 SOURCES += main.cpp

 INCLUDEPATH += /usr/local/Cellar/boost/1.55.0_2

And the main file:

 #include <QCoreApplication>
 #include <QtCore>
 #include <iostream>
 #include <QDebug>

 #include <boost/regex.hpp>

 using namespace std;

 int main(int argc, char *argv[])
 {
   QCoreApplication a(argc, argv);

   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;
   }
   return a.exec();
 }

Not compiling. Issues:

Symbol(s) not found for architectures x86_64
linker command failed with exist code 1

Since I am absolutely noob with boost, did I do it right? If yes, why is it not compiling?

Thanks a lot!

Igor Tupitsyn
  • 1,193
  • 3
  • 18
  • 45

1 Answers1

1

You need to link with boost too!

LIBS += -L/usr/local/Cellar/boost/1.55.0_2/lib -lboost
Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
  • Reinstalled my boost. It is now in usr/local/. Including this: `LIBS += -L/usr/local/lib \ -lboost_regex` still produces the architecture error. Having what you said (LIBS += -L/usr/local/lib -lboost) gives "Library not found for lboost" error. – Igor Tupitsyn Aug 18 '14 at 22:52
  • Inserting this `CONFIG += c++11` into the project file seems to have solved the problem. Thanks for your help! – Igor Tupitsyn Aug 19 '14 at 10:40