Igor Tupitsyn
Igor Tupitsyn

Reputation: 1193

Boost in Qt: Installation and Symbol(s) not found for architectures x86_64

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!

Upvotes: 0

Views: 427

Answers (1)

You need to link with boost too!

LIBS += -L/usr/local/Cellar/boost/1.55.0_2/lib -lboost

Upvotes: 1

Related Questions