I am pretty new to c and c++, so please try explain more specific what I should do. The program tries to read files from a directory using multithreads, and store the information in a map so that it can be used later.
I have been looking for similar posts. However, I am not able to figure out.
In https://github.com/kaldi-asr/kaldi/issues/938, it said that "If you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace or the tag [abi:cxx11] then it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro."
The solution for undefined reference to `pthread_cancel' (add "-pthread" flag does not work either.
My code is
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <map>
#include <algorithm>
#include <random>
#include <unistd.h>
#include <cmath>
#include <stdlib.h>
#include <mutex>
#include <sys/wait.h>
#include <filesystem>
#include <string>
#include <pthread.h>
#define time_str(s) (s < 60 ? (to_string(s) + " second(s)") : (s < 3600 ? (to_string((s) / 60) + " minute(s)") : (to_string((s) / 3600) + " hour(s) and " + to_string(((s) % 3600) / 60) + " minute(s)")))
using namespace std;
namespace fs = std::filesystem;
struct MyGenom
{
vector<string> filepaths;
map<string, string> seq;
};
void check_rv(int rv) {
if (rv != 0) {
printf("Error: Value is %d\n", rv);
exit(1);
}
}
struct Reference_Genome {
static long unsigned int idx;
static map <string, string> seq;
static pthread_mutex_t mtxLock;
static vector <string> filepaths;
static void writing(string path) {
}
static void *distribution(void *var) {
}
Reference_Genome(string dir, unsigned int n_threads) {
}
};
int main(int argc, char const *argv[]) {
string dir = "./data/ex_seq";
unsigned int n_threads = 5;
Reference_Genome ref(dir, n_threads);
cout << "chr6: " << ref.seq["chr6"] << endl;
cout << "chr9: " << ref.seq["chr9"] << endl;
cout << "chr13: " << ref.seq["chr13"] << endl;
}
The gcc version is "Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)".
The error is
testSeq.cpp:97: undefined reference to `Reference_Genome::seq[abi:cxx11]'
/usr/bin/ld: testSeq.cpp:98: undefined reference to `Reference_Genome::seq[abi:cxx11]'
/usr/bin/ld: testSeq.cpp:99: undefined reference to `Reference_Genome::seq[abi:cxx11]'
/usr/bin/ld: /tmp/cctfwVX2.o: in function `Reference_Genome::writing(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/testSeq.cpp:46: undefined reference to `Reference_Genome::seq[abi:cxx11]'
/usr/bin/ld: testSeq.cpp:48: undefined reference to `Reference_Genome::seq[abi:cxx11]'
/usr/bin/ld: /tmp/cctfwVX2.o: in function `Reference_Genome::distribution(void*)':
testSeq.cpp:55: undefined reference to `Reference_Genome::filepaths[abi:cxx11]'
/usr/bin/ld: testSeq.cpp:55: undefined reference to `Reference_Genome::idx'
/usr/bin/ld: testSeq.cpp:56: undefined reference to `Reference_Genome::mtxLock'
/usr/bin/ld: testSeq.cpp:57: undefined reference to `Reference_Genome::idx'
/usr/bin/ld: testSeq.cpp:57: undefined reference to `Reference_Genome::filepaths[abi:cxx11]'
/usr/bin/ld: testSeq.cpp:58: undefined reference to `Reference_Genome::idx'
/usr/bin/ld: testSeq.cpp:58: undefined reference to `Reference_Genome::idx'
/usr/bin/ld: testSeq.cpp:59: undefined reference to `Reference_Genome::mtxLock'
/usr/bin/ld: /tmp/cctfwVX2.o: in function `Reference_Genome::Reference_Genome(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)':
testSeq.cpp:68: undefined reference to `Reference_Genome::filepaths[abi:cxx11]'
/usr/bin/ld: testSeq.cpp:70: undefined reference to `Reference_Genome::idx'
/usr/bin/ld: testSeq.cpp:72: undefined reference to `Reference_Genome::mtxLock'
/usr/bin/ld: testSeq.cpp:85: undefined reference to `Reference_Genome::mtxLock'
/usr/bin/ld: testSeq.cpp:88: undefined reference to `Reference_Genome::filepaths[abi:cxx11]'
collect2: error: ld returned 1 exit status
When you declare static variables inside a class, you must also declare it exactly once outside of the class. In this case, you could put this in the bottom of your C++ file or in between the main() function and the class Reference_Genome definition:
long unsigned int Reference_Genome::idx;
map <string, string> Reference_Genome::seq;
pthread_mutex_t Reference_Genome::mtxLock;
vector <string> Reference_Genome::filepaths;
The idea is that you can put the class definition inside a header file, to be included in multiple different compilation units, but the static variables are only defined once, in one .cpp file of your choosing.
Related
I'm making program to read and write json file.
My code:
#include <bits/stdc++.h>
#include <json/json.h>
#include <json/reader.h>
using namespace std;
int main()
{
ifstream file("input.json");
Json::Value value;
Json::Reader reader;
reader.parse(file, value);
cout << value << endl;
return 0;
}
When I run the program, it's return errors:
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0x3f): undefined reference to `Json::Value::Value(Json::ValueType)'
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0x4b): undefined reference to `Json::Reader::Reader()'
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0x6b): undefined reference to `Json::Reader::parse(std::istream&, Json::Value&, bool)'
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0x7e): undefined reference to `Json::operator<<(std::ostream&, Json::Value const&)'
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0xaa): undefined reference to `Json::Value::~Value()'
C:\Users\Admin\AppData\Local\Temp\ccpsFhxG.o:filemanager.cpp:(.text+0xdd): undefined reference to `Json::Value::~Value()'
I already try to add param -ljsoncpp but it said C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ljsoncpp
It's there any way to fix this problem? I installed jsoncpp from https://github.com/open-source-parsers/jsoncpp.
I fixed this problem. Just need to run file amalgamate.py (Python >= 2.6 required), it will create three files:
dist/jsoncpp.cpp, the source file to be added to your project
dist/json/json.h, the correspondent header file
dist/json/json-forwards.h, which contains forward declarations of JSON types.
Import file jsoncpp.cpp to your program and it works fine.
This question already has answers here:
multiple definition in c++ files
(1 answer)
Multiple definition error on variable that is declared and defined in header file and used only in its cpp file
(3 answers)
Wierd multiple definition linking error with header guards [duplicate]
(1 answer)
Closed 9 months ago.
I've been working on an existing project and added functionality to it.
I've added a new class and header, but when it comes to building I'm getting surprising errors.
I can't post the exact code because its proprietary but the below describes the issue.
newfile.h:
#include <vector>
#include <string>
#include <boost/foreach.hpp>
#include <iostream>
#include "siblingFile1.h"
#include "siblingFile2.h"
#include "siblingFile3.h"
#include "siblingFile4.h"
using namespace json_spirit;
using namespace std;
using namespace boost;
int usefulVariable1 = 60;
vector<string> usefulVariable2 = {"abc"};
string usefulVariable3 = "abc";
int64 usefulVariable4 = 0;
Object method1(int64 nValue);
CustomType1 method2(int64 nValue);
bool method3(CustomType2 var2, int64 xValue);
bool method4(CustomType1 var1, int64 xValue);
bool method5(CustomType1 var1, long xValue);
with newfile.cpp:
#include <string>
#include <boost/foreach.hpp>
#include <iostream>
#include "siblingFile1.h"
#include "siblingFile2.h"
#include "siblingFile3.h"
#include "siblingFile4.h"
#include "newfile.h"
using namespace json_spirit;
using namespace std;
using namespace boost;
Object method1(int64 nValue) {
.... does some stuff
}
CustomType1 method2(int64 nValue) {
.... does some stuff
}
bool method3(CustomType2 var2, int64 xValue)
{
.... does some stuff
}
bool method5(CustomType1 var1, long xValue)
{
int64 x = (int64)xValue;
return method4(x, x);
}
bool method4(CustomType1 var1, int64 xValue)
{
.... does some stuff
}
I then use a few of these methods throughout the code, in a number of different classes.
I added method5 as a result of the compile errors I was getting to overload and guide to the correct method.
The error are below:
obj/oFile1.o:/path/to/source/src/newfile.h:17: multiple definition of `usefulVariable4'
obj/main.o:/path/to/source/src/newfile.h:17: first defined here
obj/oFile1.o:(.bss+0x40): multiple definition of `usefulVariable2[abi:cxx11]'
obj/main.o:(.bss+0x500): first defined here
obj/oFile1.o:(.bss+0x20): multiple definition of `NothingIChanged[abi:cxx11]'
obj/main.o:(.bss+0x4e0): first defined here
obj/oFile1.o:/path/to/source/src/newfile.h:14: multiple definition of `usefulVariable1'
obj/main.o:/path/to/source/src/newfile.h:14: first defined here
obj/oFile2.o:/path/to/source/src/newfile.h:17: multiple definition of `usefulVariable4'
obj/main.o:/path/to/source/src/newfile.h:17: first defined here
obj/oFile2.o:(.bss+0x40): multiple definition of `usefulVariable2[abi:cxx11]'
obj/main.o:(.bss+0x500): first defined here
obj/oFile2.o:(.bss+0x20): multiple definition of `NothingIChanged[abi:cxx11]'
obj/main.o:(.bss+0x4e0): first defined here
obj/oFile2.o:/path/to/source/src/newfile.h:14: multiple definition of `usefulVariable1'
obj/main.o:/path/to/source/src/newfile.h:14: first defined here
obj/main.o: In function `FunctionImplimentingNewMethod1(... params)':
/path/to/source/src/main.cpp:2289: undefined reference to `method5(CustomType1, long long)'
/path/to/source/src/main.cpp:2301: undefined reference to `method3(CustomType2, long long)'
obj/main.o: In function `FunctionImplimentingNewMethod2(... params)':
/path/to/source/src/main.cpp:575: undefined reference to `method5(CustomType1, long long)'
obj/main.o: In function `FunctionImplimentingNewMethod3(... params)':
/path/to/source/src/main.cpp:643: undefined reference to `method5(CustomType1, long long)'
obj/main.o: In function `aClass1::FunctionImplimentingNewMethod4(... params)':
/path/to/source/src/main.cpp:1547: undefined reference to `method5(CustomType1, long long)'
obj/main.o: In function `aClass1::FunctionImplimentingNewMethod5(... params)':
/path/to/source/src/main.cpp:1575: undefined reference to `method5(CustomType1, long long)'
obj/main.o: In function `FunctionImplimentingNewMethod6(... params)':
/path/to/source/src/main.cpp:1608: undefined reference to `method5(CustomType1, long long)'
obj/main.o:/path/to/source/src/main.cpp:817: more undefined references to `method5(CustomType1, long long)' follow
obj/main.o: In function `FunctionImplimentingNewMethod7(... params)':
/path/to/source/src/main.cpp:2367: undefined reference to `method3(CustomType2, long long)'
obj/oFile2.o: In function `aClass2::FunctionImplimentingNewMethod8()':
/path/to/source/src/oFile2.cpp:861: undefined reference to `method5(CustomType1, long long)'
obj/oFile1.o: In function `FunctionImplimentingNewMethod9(... params)':
/path/to/source/src/oFile1.cpp:298: undefined reference to `method1[abi:cxx11](long long)'
/path/to/source/src/oFile1.cpp:307: undefined reference to `method5(CustomType1, long long)'
collect2: error: ld returned 1 exit status
As can be seen I added method5 and usefulVariable4 to try and overcome the issue. Passing usefulVariable4 as a parameter to force it to use type int64; but it's not having it.
Do I need to update the makefile?
I haven't updated any of the CallingFile's headers as the code is always used inside the cpp file method bodies, not types needed in the CallingFile's headers.
CallingFile.cpp:
#include "newfile.h"
... rest of file ...
SomeMethodWhereINeedToAddMyFunctionallity()
{
... existing code ...
method4(localVar, 0) // fails to compile
or
method4(localVar, userfulVariable4) // fails to compile
or
method5(localVar, 0) // fails to compile
}
make version:
GNU Make 4.1
Built for x86_64-pc-linux-gnu
What is causing this?
Thank you.
I am trying to read a jpg file with boost::gil. I started with the following code snippets but I got stuck already.
#include <iostream>
#include <vector>
#include <string>
#include <boost/gil/gil_all.hpp>
#include <boost/gil/extension/io/jpeg_dynamic_io.hpp>
void ReadAnImage( std::string fname ){
std::vector<std::vector<float> > points;
boost::gil::rgb8_image_t img;
boost::gil::jpeg_read_image( fname , img );
}
int main( void ){
ReadAnImage( "pic.jpg" );
}
When I try to compile this code with
g++ -I ~/programs/cpp/boost/include/ -std=c++11 main.cpp -o main
I get the following error
MainNew.cpp:(.text._ZN5boost3gil6detail11jpeg_reader4initEv[_ZN5boost3gil6detail11jpeg_reader4initEv]+0x1a): undefined reference to jpeg_std_error' MainNew.cpp:(.text._ZN5boost3gil6detail11jpeg_reader4initEv[_ZN5boost3gil6detail11jpeg_reader4initEv]+0x3f): undefined reference to jpeg_CreateDecompress'
MainNew.cpp:(.text._ZN5boost3gil6detail11jpeg_reader4initEv[_ZN5boost3gil6detail11jpeg_reader4initEv]+0x61): undefined reference to jpeg_stdio_src' MainNew.cpp:(.text._ZN5boost3gil6detail11jpeg_reader4initEv[_ZN5boost3gil6detail11jpeg_reader4initEv]+0x76): undefined reference to jpeg_read_header'
/tmp/ccrGnMRc.o: In function boost::gil::detail::jpeg_reader::~jpeg_reader()': MainNew.cpp:(.text._ZN5boost3gil6detail11jpeg_readerD2Ev[_ZN5boost3gil6detail11jpeg_readerD5Ev]+0x18): undefined reference to jpeg_destroy_decompress'
/tmp/ccrGnMRc.o: In function void boost::gil::detail::jpeg_reader::apply<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::pixel<unsigned char, boost::gil::layout<boost::mpl::ve ctor3<boost::gil::red_t, boost::gil::green_t, boost::gil::blue_t>, boost::mpl::range_c<int, 0, 3> > >*> > > >(boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::pixel<unsigned cha r, boost::gil::layout<boost::mpl::vector3<boost::gil::red_t, boost::gil::green_t, boost::gil::blue_t>, boost::mpl::range_c<int, 0, 3> > >*> > > const&)': MainNew.cpp:(.text._ZN5boost3gil6detail11jpeg_reader5applyINS0_10image_viewINS0_23memory_based_2d_locatorINS0_26memory_based_step_iteratorIPNS0_5pixelIhNS0_6layoutINS_3mpl7vector3INS0_5red_tENS0_7green_tENS0_6blue_tEEENS9_7range_cIiLi0ELi 3EEEEEEEEEEEEEEEvRKT_[_ZN5boost3gil6detail11jpeg_reader5applyINS0_10image_viewINS0_23memory_based_2d_locatorINS0_26memory_based_step_iteratorIPNS0_5pixelIhNS0_6layoutINS_3mpl7vector3INS0_5red_tENS0_7green_tENS0_6blue_tEEENS9_7range_cIiLi0 ELi3EEEEEEEEEEEEEEEvRKT_]+0x2e): undefined reference to jpeg_start_decompress'
MainNew.cpp:(.text.ZN5boost3gil6detail11jpeg_reader5applyINS0_10image_viewINS0_23memory_based_2d_locatorINS0_26memory_based_step_iteratorIPNS0_5pixelIhNS0_6layoutINS_3mpl7vector3INS0_5red_tENS0_7green_tENS0_6blue_tEEENS9_7range_cIiLi0ELi
3EEEEEEEEEEEEEEEvRKT[ZN5boost3gil6detail11jpeg_reader5applyINS0_10image_viewINS0_23memory_based_2d_locatorINS0_26memory_based_step_iteratorIPNS0_5pixelIhNS0_6layoutINS_3mpl7vector3INS0_5red_tENS0_7green_tENS0_6blue_tEEENS9_7range_cIiLi0
ELi3EEEEEEEEEEEEEEEvRKT]+0x13e): undefined reference to jpeg_read_scanlines' MainNew.cpp:(.text._ZN5boost3gil6detail11jpeg_reader5applyINS0_10image_viewINS0_23memory_based_2d_locatorINS0_26memory_based_step_iteratorIPNS0_5pixelIhNS0_6layoutINS_3mpl7vector3INS0_5red_tENS0_7green_tENS0_6blue_tEEENS9_7range_cIiLi0ELi 3EEEEEEEEEEEEEEEvRKT_[_ZN5boost3gil6detail11jpeg_reader5applyINS0_10image_viewINS0_23memory_based_2d_locatorINS0_26memory_based_step_iteratorIPNS0_5pixelIhNS0_6layoutINS_3mpl7vector3INS0_5red_tENS0_7green_tENS0_6blue_tEEENS9_7range_cIiLi0 ELi3EEEEEEEEEEEEEEEvRKT_]+0x1ad): undefined reference to jpeg_finish_decompress'
collect2: error: ld returned 1 exit status
I am not quite sure what I am doing wrong. Because according to the documentation
https://www.boost.org/doc/libs/1_74_0/libs/gil/doc/html/index.html
the jpeg_read_image should be included in boost::gil. Am I maybe missing another header file??
Any hints are much appreciated.
I have following program which recursively traverses all the files inside a directory->
#include "boost/filesystem.hpp"
#include "boost/regex.hpp"
#include "string"
#include <iostream>
using namespace boost;
using namespace std;
int main()
{
filesystem::path current_dir("."); //
boost::regex pattern("a.*"); // list all files starting with a
for (filesystem::recursive_directory_iterator iter(current_dir), end;
iter != end;
++iter)
{
std::string name = iter->path().filename().string();
if (regex_match(name, pattern))
std::cout << iter->path() << "\n";
}
}
I compile this program using command:
g++ directory_iterate.cpp -lboost_filesystem -lboost_regex -lboost_system
and I get following errors:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../libboost_regex.so: undefined reference to `std::__detail::_List_node_base::_M_unhook()#GLIBCXX_3.4.15'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../libboost_regex.so: undefined reference to `std::overflow_error::~overflow_error()#GLIBCXX_3.4.15'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../libboost_regex.so: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)#GLIBCXX_3.4.15'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../libboost_regex.so: undefined reference to `std::invalid_argument::~invalid_argument()#GLIBCXX_3.4.15'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../libboost_filesystem.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)#GLIBCXX_3.4.20'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../libboost_regex.so: undefined reference to `std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)#GLIBCXX_3.4.15'
I am trying to experiment with the Poco library in order to send an email.
However when I try using the library I get an undefined error.
I think it has something to do with the compiler I used for Poco, but I am unsure which compiler I should use so that QT and Poco are compiled with the same thing.
Mass_Mailer.pro
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Mass_Mailer
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
INCLUDEPATH += /usr/local/include/
main.cpp
#include "mainwindow.h"
#include <QApplication>
#include <iostream>
#include <Poco/Net/MailMessage.h>
#include <Poco/Net/MailRecipient.h>
#include <Poco/Net/SMTPClientSession.h>
#include <Poco/Net/NetException.h>
using namespace std;
using namespace Poco::Net;
using namespace Poco;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
int sendmail()
{
string host = "mail.domain.com";
UInt16 port = 25;
string user = "xxx";
string password = "xxx";
string to = "xxx#domain.com";
string from = "xxx#domain.com";
string subject = "Your first e-mail message sent using Poco Libraries";
subject = MailMessage::encodeWord(subject.c_str(), "UTF-8");
string content = "Well done! You've successfully sent your first message using Poco SMTPClientSession";
MailMessage message;
message.setSender(from);
message.addRecipient(MailRecipient(MailRecipient::PRIMARY_RECIPIENT, to));
message.setSubject(subject);
message.setContentType("text/plain; charset=UTF-8");
message.setContent(content, MailMessage::ENCODING_8BIT);
try {
SMTPClientSession session(host, port);
session.open();
try {
session.login(SMTPClientSession::AUTH_LOGIN, user, password);
session.sendMessage(message);
cout << "Message successfully sent" << endl;
session.close();
} catch (SMTPException &e) {
cerr << e.displayText() << endl;
session.close();
return 0;
}
} catch (NetException &e) {
cerr << e.displayText() << endl;
return 0;
}
return 0;
}
Errors
main.o: In function `sendmail()':
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:31: undefined reference to `Poco::Net::MailMessage::encodeWord(std::string const&, std::string const&)'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:33: undefined reference to `Poco::Net::MailMessage::MailMessage()'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:34: undefined reference to `Poco::Net::MailMessage::setSender(std::string const&)'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:35: undefined reference to `Poco::Net::MailRecipient::MailRecipient(Poco::Net::MailRecipient::RecipientType, std::string const&)'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:35: undefined reference to `Poco::Net::MailMessage::addRecipient(Poco::Net::MailRecipient const&)'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:35: undefined reference to `Poco::Net::MailRecipient::~MailRecipient()'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:36: undefined reference to `Poco::Net::MailMessage::setSubject(std::string const&)'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:37: undefined reference to `Poco::Net::MailMessage::setContentType(std::string const&)'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:38: undefined reference to `Poco::Net::MailMessage::setContent(std::string const&, Poco::Net::MailMessage::ContentTransferEncoding)'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:40: undefined reference to `Poco::Net::SMTPClientSession::SMTPClientSession(std::string const&, unsigned short)'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:41: undefined reference to `Poco::Net::SMTPClientSession::open()'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:43: undefined reference to `Poco::Net::SMTPClientSession::login(Poco::Net::SMTPClientSession::LoginMethod, std::string const&, std::string const&)'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:44: undefined reference to `Poco::Net::SMTPClientSession::sendMessage(Poco::Net::MailMessage const&)'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:46: undefined reference to `Poco::Net::SMTPClientSession::close()'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:46: undefined reference to `Poco::Net::SMTPClientSession::~SMTPClientSession()'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:33: undefined reference to `Poco::Net::MailMessage::~MailMessage()'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:35: undefined reference to `Poco::Net::MailRecipient::~MailRecipient()'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:48: undefined reference to `Poco::Exception::displayText() const'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:49: undefined reference to `Poco::Net::SMTPClientSession::close()'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:51: undefined reference to `Poco::Net::SMTPClientSession::~SMTPClientSession()'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:53: undefined reference to `Poco::Exception::displayText() const'
/home/mongo/Cpp/Mass_Mailer/build-Mass_Mailer-Desktop-Debug/../Mass_Mailer/main.cpp:33: undefined reference to `Poco::Net::MailMessage::~MailMessage()'
main.o:(.gcc_except_table+0x120): undefined reference to `typeinfo for Poco::Net::SMTPException'
main.o:(.gcc_except_table+0x124): undefined reference to `typeinfo for Poco::Net::NetException'
collect2: error: ld returned 1 exit status
make: *** [Mass_Mailer] Error 1
11:45:01: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project Mass_Mailer (kit: Desktop)
When executing step 'Make'11:45:01: Elapsed time: 00:02.
You need to link Poco libraries to your project. In the project file, add something like this:
LIBS += -lPocoNet -lPocoFoundation