Undefined Reference when OpenCV libraries cross compiled in Eclipse for Raspberry Pi - c++

I am cross-compiling OpenCV libraries (2.4.9) and Raspicam (0.1.3) in Eclipse CDT IDE for Raspberry Pi. I am trying to compile a basic application that looks as the following:
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include <raspicam.h>
#include <raspicam_cv.h>
using namespace std;
using namespace cv;
int main()
{
....
namedWindow(output_window_name, CV_WINDOW_AUTOSIZE);
namedWindow(grayscale_window_name, 100);
namedWindow(thresholded_window_name, 100);
namedWindow(contours_window_name, 100);
moveWindow(grayscale_window_name, 20,20);
moveWindow(thresholded_window_name, 20, 250);
moveWindow(contours_window_name, 20, 600);
vector<int> compression_params;
compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
compression_params.push_back(100);
raspicam::RaspiCam_Cv Camera;
....
}
To compile I made sure that libopencv_*.so files are in the cross compilation sysroot and linked in Eclipse using -l flags such as -lopencv_core -lopencv_highgui etc. I also included every include/ folder in sources using -I flag in Eclipse Build Settings.
Inclusion using #include and namespace declarations do not result in any errors.
Target building looks like this in the console:
arm-linux-gnueabihf-g++
-L"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\usr\lib"
-L"C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf"
-L"C:\rpi-eclipse\workspace\RaspberryTest\libbluetooth"
-L"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\lib"
-Wl,-rpath-link,"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\lib\arm-linux-gnueabihf"
-o "RaspberryTest" ./src/<ALL OBJS>
-lwiringPi
-lopencv_calib3d
-lopencv_core
-lopencv_features2d
-lopencv_flann
-lopencv_highgui
-lopencv_imgproc
-lopencv_ml
-lopencv_objdetect
-lopencv_video
-lbluetooth
-lpthread
-lwiringPiDev
However, the following errors are there:
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:115: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:116: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:117: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:118: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:120: undefined reference to `cv::moveWindow(std::string const&, int, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:121: undefined reference to `cv::moveWindow(std::string const&, int, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:122: undefined reference to `cv::moveWindow(std::string const&, int, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:129: undefined reference to `raspicam::RaspiCam_Cv::RaspiCam_Cv()'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:131: undefined reference to `raspicam::RaspiCam_Cv::open()'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:194: undefined reference to `raspicam::RaspiCam_Cv::grab()'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:195: undefined reference to `raspicam::RaspiCam_Cv::retrieve(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:208: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:208: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:211: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:211: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:215: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:215: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:219: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:219: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:220: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:220: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:220: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:224: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:224: undefined reference to `cv::floodFill(cv::_OutputArray const&, cv::Point_<int>, cv::Scalar_<double>, cv::Rect_<int>*, cv::Scalar_<double>, cv::Scalar_<double>, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:228: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:228: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:233: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:233: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:238: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:238: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:240: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:240: undefined reference to `cv::findContours(cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, int, cv::Point_<int>)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:129: undefined reference to `raspicam::RaspiCam_Cv::~RaspiCam_Cv()'
./src/tasks/image_processing_task.o: In function `cv::Mat::clone() const':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:335: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray(cv::Scalar_<double> const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1137: undefined reference to `vtable for cv::_InputArray'
./src/tasks/image_processing_task.o: In function `cv::_OutputArray::_OutputArray<cv::Point_<int> >(std::vector<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >, std::allocator<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > > >&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1145: undefined reference to `vtable for cv::_OutputArray'
./src/tasks/image_processing_task.o: In function `cv::_OutputArray::_OutputArray<cv::Vec<int, 4> >(std::vector<cv::Vec<int, 4>, std::allocator<cv::Vec<int, 4> > >&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1143: undefined reference to `vtable for cv::_OutputArray'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray<cv::Point_<int> >(std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1122: undefined reference to `vtable for cv::_InputArray'
./src/tasks/image_processing_task.o: In function `cv::_OutputArray::_OutputArray<cv::Point_<int> >(std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1143: undefined reference to `vtable for cv::_OutputArray'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray<cv::Point_<int> >(std::vector<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >, std::allocator<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > > > const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1125: undefined reference to `vtable for cv::_InputArray'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray<cv::Vec<int, 4> >(std::vector<cv::Vec<int, 4>, std::allocator<cv::Vec<int, 4> > > const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1122: undefined reference to `vtable for cv::_InputArray'
collect2.exe: error: ld returned 1 exit status
make: *** [RaspberryTest] Error 1
This indicates that I have two type of errors.
1-) undefined reference (for functions)
2-) undefined reference to vtable` (Related to virtual functions I believe)
In order to overcome this problem, I feel like I have to change STL/C standards, but do not know what to do exactly. Also, the fact that libraries are compiled and included correctly but there are still undefined references is really weird to me.
Any guidance regarding how to solve this problem is greately appreciated.
Thanks in advance.

Related

Cannot build the HelloWorld Poco Example Program on Ubuntu

I've just installed Poco on Ubuntu (by compiling from the code on the git master branch at release 1.9.0). And now I'm trying to compile my HelloWorld.cpp.
This is what I've tried:
g++ -L/usr/local/lib -lPocoFoundation -lPocoUtil -lPocoNet -lPocoNetd -lPocoData -lPocoXML ./helloworld.cpp
This is the helloworld.cpp content:
#include "Poco/Net/HTTPServer.h"
#include "Poco/Net/HTTPRequestHandler.h"
#include "Poco/Net/HTTPRequestHandlerFactory.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"
#include "Poco/Net/ServerSocket.h"
#include "Poco/Util/ServerApplication.h"
#include <iostream>
using namespace Poco;
using namespace Poco::Net;
using namespace Poco::Util;
class HelloRequestHandler: public HTTPRequestHandler
{
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
{
Application& app = Application::instance();
app.logger().information("Request from %s", request.clientAddress().toString());
response.setChunkedTransferEncoding(true);
response.setContentType("text/html");
response.send()
<< "<html>"
<< "<head><title>Hello</title></head>"
<< "<body><h1>Hello from the POCO Web Server</h1></body>"
<< "</html>";
}
};
class HelloRequestHandlerFactory: public HTTPRequestHandlerFactory
{
HTTPRequestHandler* createRequestHandler(const HTTPServerRequest&)
{
return new HelloRequestHandler;
}
};
class WebServerApp: public ServerApplication
{
void initialize(Application& self)
{
loadConfiguration();
ServerApplication::initialize(self);
}
int main(const std::vector<std::string>&)
{
UInt16 port = static_cast<UInt16>(config().getUInt("port", 8080));
HTTPServer srv(new HelloRequestHandlerFactory, port);
srv.start();
logger().information("HTTP Server started on port %hu.", port);
waitForTerminationRequest();
logger().information("Stopping HTTP Server...");
srv.stop();
return Application::EXIT_OK;
}
};
POCO_SERVER_MAIN(WebServerApp)
I expect by keeping adding the libraries I link in the g++ command line it should eventually allow me to compile the program.
But it seems no matter how many libraries I tried to link I'm still getting the following errors (without eliminating any of the errors with how many libraries I add on the way):
kennyyu#kennyyu-ubuntu:~/poco/myexample$ g++ -L/usr/local/lib -lPocoFoundation -lPocoUtil -lPocoNet -lPocoNetd -lPocoData -lPocoXML ./helloworld.cpp
/tmp/ccWTd1HS.o: In function `main':
helloworld.cpp:(.text+0x53): undefined reference to `Poco::Util::ServerApplication::run(int, char**)'
helloworld.cpp:(.text+0xd1): undefined reference to `Poco::Exception::displayText[abi:cxx11]() const'
/tmp/ccWTd1HS.o: In function `Poco::Net::Impl::IPv4SocketAddressImpl::host() const':
helloworld.cpp:(.text._ZNK4Poco3Net4Impl21IPv4SocketAddressImpl4hostEv[_ZNK4Poco3Net4Impl21IPv4SocketAddressImpl4hostEv]+0x28): undefined reference to `Poco::Net::IPAddress::IPAddress(void const*, unsigned int)'
/tmp/ccWTd1HS.o: In function `Poco::Net::Impl::IPv6SocketAddressImpl::host() const':
helloworld.cpp:(.text._ZNK4Poco3Net4Impl21IPv6SocketAddressImpl4hostEv[_ZNK4Poco3Net4Impl21IPv6SocketAddressImpl4hostEv]+0x2e): undefined reference to `Poco::Net::IPAddress::IPAddress(void const*, unsigned int, unsigned int)'
/tmp/ccWTd1HS.o: In function `Poco::ReferenceCounter::ReferenceCounter()':
helloworld.cpp:(.text._ZN4Poco16ReferenceCounterC2Ev[_ZN4Poco16ReferenceCounterC5Ev]+0x19): undefined reference to `Poco::AtomicCounter::AtomicCounter(int)'
/tmp/ccWTd1HS.o: In function `Poco::Logger::log(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority)':
helloworld.cpp:(.text._ZN4Poco6Logger3logERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_7Message8PriorityE[_ZN4Poco6Logger3logERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_7Message8PriorityE]+0xa0): undefined reference to `Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority)'
helloworld.cpp:(.text._ZN4Poco6Logger3logERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_7Message8PriorityE[_ZN4Poco6Logger3logERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_7Message8PriorityE]+0xbe): undefined reference to `Poco::Message::~Message()'
helloworld.cpp:(.text._ZN4Poco6Logger3logERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_7Message8PriorityE[_ZN4Poco6Logger3logERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_7Message8PriorityE]+0xd2): undefined reference to `Poco::Message::~Message()'
/tmp/ccWTd1HS.o: In function `Poco::Logger::information(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Any const&)':
helloworld.cpp:(.text._ZN4Poco6Logger11informationERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_3AnyE[_ZN4Poco6Logger11informationERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_3AnyE]+0x37): undefined reference to `Poco::format(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Any const&)'
/tmp/ccWTd1HS.o: In function `Poco::Util::Application::logger() const':
helloworld.cpp:(.text._ZNK4Poco4Util11Application6loggerEv[_ZNK4Poco4Util11Application6loggerEv]+0x30): undefined reference to `Poco::Bugcheck::nullPointer(char const*, char const*, int)'
/tmp/ccWTd1HS.o: In function `Poco::Util::Application::instance()':
helloworld.cpp:(.text._ZN4Poco4Util11Application8instanceEv[_ZN4Poco4Util11Application8instanceEv]+0x7): undefined reference to `Poco::Util::Application::_pInstance'
helloworld.cpp:(.text._ZN4Poco4Util11Application8instanceEv[_ZN4Poco4Util11Application8instanceEv]+0x24): undefined reference to `Poco::Bugcheck::nullPointer(char const*, char const*, int)'
helloworld.cpp:(.text._ZN4Poco4Util11Application8instanceEv[_ZN4Poco4Util11Application8instanceEv]+0x2b): undefined reference to `Poco::Util::Application::_pInstance'
/tmp/ccWTd1HS.o: In function `HelloRequestHandler::handleRequest(Poco::Net::HTTPServerRequest&, Poco::Net::HTTPServerResponse&)':
helloworld.cpp:(.text._ZN19HelloRequestHandler13handleRequestERN4Poco3Net17HTTPServerRequestERNS1_18HTTPServerResponseE[_ZN19HelloRequestHandler13handleRequestERN4Poco3Net17HTTPServerRequestERNS1_18HTTPServerResponseE]+0x73): undefined reference to `Poco::Net::SocketAddress::toString[abi:cxx11]() const'
helloworld.cpp:(.text._ZN19HelloRequestHandler13handleRequestERN4Poco3Net17HTTPServerRequestERNS1_18HTTPServerResponseE[_ZN19HelloRequestHandler13handleRequestERN4Poco3Net17HTTPServerRequestERNS1_18HTTPServerResponseE]+0x100): undefined reference to `Poco::Net::HTTPMessage::setChunkedTransferEncoding(bool)'
helloworld.cpp:(.text._ZN19HelloRequestHandler13handleRequestERN4Poco3Net17HTTPServerRequestERNS1_18HTTPServerResponseE[_ZN19HelloRequestHandler13handleRequestERN4Poco3Net17HTTPServerRequestERNS1_18HTTPServerResponseE]+0x139): undefined reference to `Poco::Net::HTTPMessage::setContentType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccWTd1HS.o: In function `HelloRequestHandler::HelloRequestHandler()':
helloworld.cpp:(.text._ZN19HelloRequestHandlerC2Ev[_ZN19HelloRequestHandlerC5Ev]+0x14): undefined reference to `Poco::Net::HTTPRequestHandler::HTTPRequestHandler()'
/tmp/ccWTd1HS.o: In function `WebServerApp::initialize(Poco::Util::Application&)':
helloworld.cpp:(.text._ZN12WebServerApp10initializeERN4Poco4Util11ApplicationE[_ZN12WebServerApp10initializeERN4Poco4Util11ApplicationE]+0x1d): undefined reference to `Poco::Util::Application::loadConfiguration(int)'
helloworld.cpp:(.text._ZN12WebServerApp10initializeERN4Poco4Util11ApplicationE[_ZN12WebServerApp10initializeERN4Poco4Util11ApplicationE]+0x30): undefined reference to `Poco::Util::Application::initialize(Poco::Util::Application&)'
/tmp/ccWTd1HS.o: In function `HelloRequestHandlerFactory::HelloRequestHandlerFactory()':
helloworld.cpp:(.text._ZN26HelloRequestHandlerFactoryC2Ev[_ZN26HelloRequestHandlerFactoryC5Ev]+0x14): undefined reference to `Poco::Net::HTTPRequestHandlerFactory::HTTPRequestHandlerFactory()'
/tmp/ccWTd1HS.o: In function `WebServerApp::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
helloworld.cpp:(.text._ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE[_ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE]+0x7c): undefined reference to `Poco::Util::AbstractConfiguration::getUInt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) const'
helloworld.cpp:(.text._ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE[_ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE]+0xb6): undefined reference to `Poco::Net::HTTPServerParams::HTTPServerParams()'
helloworld.cpp:(.text._ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE[_ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE]+0x11d): undefined reference to `Poco::Net::HTTPServer::HTTPServer(Poco::SharedPtr<Poco::Net::HTTPRequestHandlerFactory, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::Net::HTTPRequestHandlerFactory> >, unsigned short, Poco::AutoPtr<Poco::Net::HTTPServerParams>)'
helloworld.cpp:(.text._ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE[_ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE]+0x14a): undefined reference to `Poco::Net::TCPServer::start()'
helloworld.cpp:(.text._ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE[_ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE]+0x1f6): undefined reference to `Poco::Util::ServerApplication::waitForTerminationRequest()'
helloworld.cpp:(.text._ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE[_ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE]+0x273): undefined reference to `Poco::Net::TCPServer::stop()'
helloworld.cpp:(.text._ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE[_ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE]+0x287): undefined reference to `Poco::Net::HTTPServer::~HTTPServer()'
helloworld.cpp:(.text._ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE[_ZN12WebServerApp4mainERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS6_EE]+0x3a4): undefined reference to `Poco::Net::HTTPServer::~HTTPServer()'
/tmp/ccWTd1HS.o: In function `WebServerApp::WebServerApp()':
helloworld.cpp:(.text._ZN12WebServerAppC2Ev[_ZN12WebServerAppC5Ev]+0x14): undefined reference to `Poco::Util::ServerApplication::ServerApplication()'
/tmp/ccWTd1HS.o: In function `Poco::ReferenceCounter::~ReferenceCounter()':
helloworld.cpp:(.text._ZN4Poco16ReferenceCounterD2Ev[_ZN4Poco16ReferenceCounterD5Ev]+0x14): undefined reference to `Poco::AtomicCounter::~AtomicCounter()'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTV12WebServerApp[_ZTV12WebServerApp]+0x20): undefined reference to `Poco::Util::Application::name() const'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTV12WebServerApp[_ZTV12WebServerApp]+0x30): undefined reference to `Poco::Util::Application::uninitialize()'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTV12WebServerApp[_ZTV12WebServerApp]+0x38): undefined reference to `Poco::Util::Application::reinitialize(Poco::Util::Application&)'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTV12WebServerApp[_ZTV12WebServerApp]+0x40): undefined reference to `Poco::Util::ServerApplication::defineOptions(Poco::Util::OptionSet&)'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTV12WebServerApp[_ZTV12WebServerApp]+0x48): undefined reference to `Poco::Util::ServerApplication::run()'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTV12WebServerApp[_ZTV12WebServerApp]+0x50): undefined reference to `Poco::Util::Application::handleOption(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccWTd1HS.o: In function `WebServerApp::~WebServerApp()':
helloworld.cpp:(.text._ZN12WebServerAppD2Ev[_ZN12WebServerAppD5Ev]+0x22): undefined reference to `Poco::Util::ServerApplication::~ServerApplication()'
/tmp/ccWTd1HS.o: In function `HelloRequestHandlerFactory::~HelloRequestHandlerFactory()':
helloworld.cpp:(.text._ZN26HelloRequestHandlerFactoryD2Ev[_ZN26HelloRequestHandlerFactoryD5Ev]+0x22): undefined reference to `Poco::Net::HTTPRequestHandlerFactory::~HTTPRequestHandlerFactory()'
/tmp/ccWTd1HS.o: In function `HelloRequestHandler::~HelloRequestHandler()':
helloworld.cpp:(.text._ZN19HelloRequestHandlerD2Ev[_ZN19HelloRequestHandlerD5Ev]+0x22): undefined reference to `Poco::Net::HTTPRequestHandler::~HTTPRequestHandler()'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTVN4Poco3Net4Impl21IPv6SocketAddressImplE[_ZTVN4Poco3Net4Impl21IPv6SocketAddressImplE]+0x50): undefined reference to `Poco::Net::Impl::IPv6SocketAddressImpl::toString[abi:cxx11]() const'
/tmp/ccWTd1HS.o: In function `Poco::Net::Impl::IPv6SocketAddressImpl::~IPv6SocketAddressImpl()':
helloworld.cpp:(.text._ZN4Poco3Net4Impl21IPv6SocketAddressImplD2Ev[_ZN4Poco3Net4Impl21IPv6SocketAddressImplD5Ev]+0x22): undefined reference to `Poco::Net::Impl::SocketAddressImpl::~SocketAddressImpl()'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTVN4Poco3Net4Impl21IPv4SocketAddressImplE[_ZTVN4Poco3Net4Impl21IPv4SocketAddressImplE]+0x50): undefined reference to `Poco::Net::Impl::IPv4SocketAddressImpl::toString[abi:cxx11]() const'
/tmp/ccWTd1HS.o: In function `Poco::Net::Impl::IPv4SocketAddressImpl::~IPv4SocketAddressImpl()':
helloworld.cpp:(.text._ZN4Poco3Net4Impl21IPv4SocketAddressImplD2Ev[_ZN4Poco3Net4Impl21IPv4SocketAddressImplD5Ev]+0x22): undefined reference to `Poco::Net::Impl::SocketAddressImpl::~SocketAddressImpl()'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTI12WebServerApp[_ZTI12WebServerApp]+0x10): undefined reference to `typeinfo for Poco::Util::ServerApplication'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTI26HelloRequestHandlerFactory[_ZTI26HelloRequestHandlerFactory]+0x10): undefined reference to `typeinfo for Poco::Net::HTTPRequestHandlerFactory'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTI19HelloRequestHandler[_ZTI19HelloRequestHandler]+0x10): undefined reference to `typeinfo for Poco::Net::HTTPRequestHandler'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTIN4Poco3Net4Impl21IPv6SocketAddressImplE[_ZTIN4Poco3Net4Impl21IPv6SocketAddressImplE]+0x10): undefined reference to `typeinfo for Poco::Net::Impl::SocketAddressImpl'
/tmp/ccWTd1HS.o:(.data.rel.ro._ZTIN4Poco3Net4Impl21IPv4SocketAddressImplE[_ZTIN4Poco3Net4Impl21IPv4SocketAddressImplE]+0x10): undefined reference to `typeinfo for Poco::Net::Impl::SocketAddressImpl'
/tmp/ccWTd1HS.o:(.data.rel.local.DW.ref._ZTIN4Poco9ExceptionE[DW.ref._ZTIN4Poco9ExceptionE]+0x0): undefined reference to `typeinfo for Poco::Exception'
collect2: error: ld returned 1 exit status
kennyyu#kennyyu-ubuntu:~/poco/myexample$
kennyyu#kennyyu-ubuntu:~/poco/myexample$ ls /usr/local/lib/libPoco*.so
/usr/local/lib/libPocoCppParserd.so /usr/local/lib/libPocoDataMySQL.so /usr/local/lib/libPocoDataSQLited.so /usr/local/lib/libPocoFoundationd.so /usr/local/lib/libPocoMongoDBd.so /usr/local/lib/libPocoPDFd.so /usr/local/lib/libPocoUtild.so /usr/local/lib/libPocoZipd.so
/usr/local/lib/libPocoCppParser.so /usr/local/lib/libPocoDataODBCd.so /usr/local/lib/libPocoDataSQLite.so /usr/local/lib/libPocoFoundation.so /usr/local/lib/libPocoMongoDB.so /usr/local/lib/libPocoPDF.so /usr/local/lib/libPocoUtil.so /usr/local/lib/libPocoZip.so
/usr/local/lib/libPocoDatad.so /usr/local/lib/libPocoDataODBC.so /usr/local/lib/libPocoEncodingsd.so /usr/local/lib/libPocoJSONd.so /usr/local/lib/libPocoNetd.so /usr/local/lib/libPocoRedisd.so /usr/local/lib/libPocoXMLd.so
/usr/local/lib/libPocoDataMySQLd.so /usr/local/lib/libPocoData.so /usr/local/lib/libPocoEncodings.so /usr/local/lib/libPocoJSON.so /usr/local/lib/libPocoNet.so /usr/local/lib/libPocoRedis.so /usr/local/lib/libPocoXML.so
kennyyu#kennyyu-ubuntu:~/poco/myexample$
Can someone please shed me some light?
This worked for me in Ubuntu 19.10.
sudo apt install libpoco-dev
(All of the Poco libraries get installed with that.)
Create helloworld.cpp with contents from OP.
Compile with:
g++ helloworld.cpp -o helloworld.o -lPocoFoundation -lPocoNet -lPocoUtil
If that still doesn't work, you can include the location where the Poco .h files are with the -I option, and where the Poco .so files are with the -L option.
Find where the Poco .so files are located:
sudo find / -name "libPoco*.so" 2>/dev/null
/usr/lib/x86_64-linux-gnu/libPocoFoundation.so
...
sudo find / -name "ServerSocket.h" 2>/dev/null
/usr/include/Poco/Net/ServerSocket.h
The compile statement then becomes:
g++ -I/usr/include/Poco/ helloworld.cpp -o helloworld.o -L/usr/lib/x86_64-linux-gnu/ -lPocoFoundation -lPocoNet -lPocoUtil

Undefined symbol references in boost and CImg

I am new to using CImg and boost. I am getting undefined symbol references as mentioned below, in the code also shared below.
I am using this command line to build it: g++ -lboost_filesystem -lboost_system -L/usr/X11R6/lib -lm -lpthread -lX11 grayscaleConvertor.cpp &> errLog.txt
I am using the -l args in the compiler command. eg: -lboost_filesystem which I read on another post in stackoverflow, but that is not helping resolve the boost::filesystem:: symbols
locate CImg : /usr/include/CImg.h
locate boost: /usr/include/boost (plus more lines)
errLog.txt
/tmp/ccRIIPim.o: In function main':
grayscaleConvertor.cpp:(.text+0x179): undefined reference toboost::filesystem::path::extension() const'
grayscaleConvertor.cpp:(.text+0x213): undefined reference to boost::filesystem::path::filename() const'
/tmp/ccRIIPim.o: In function__static_initialization_and_destruction_0(int, int)':
grayscaleConvertor.cpp:(.text+0x68e): undefined reference to boost::system::generic_category()'
grayscaleConvertor.cpp:(.text+0x698): undefined reference toboost::system::generic_category()'
grayscaleConvertor.cpp:(.text+0x6a2): undefined reference to boost::system::system_category()'
/tmp/ccRIIPim.o: In functionboost::system::error_code::error_code()':
grayscaleConvertor.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x10): undefined reference to boost::system::system_category()'
/tmp/ccRIIPim.o: In functionboost::system::error_code::clear()':
grayscaleConvertor.cpp:(.text._ZN5boost6system10error_code5clearEv[_ZN5boost6system10error_code5clearEv]+0x10): undefined reference to boost::system::system_category()'
/tmp/ccRIIPim.o: In functionboost::filesystem::path::compare(std::__cxx11::basic_string, std::allocator > const&) const':
grayscaleConvertor.cpp:(.text._ZNK5boost10filesystem4path7compareERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK5boost10filesystem4path7compareERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x3b): undefined reference to boost::filesystem::path::compare(boost::filesystem::path const&) const'
/tmp/ccRIIPim.o: In functionboost::filesystem::exists(boost::filesystem::path const&)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x24): undefined reference to boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functionboost::filesystem::is_directory(boost::filesystem::path const&)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x24): undefined reference to boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functionboost::filesystem::is_regular_file(boost::filesystem::path const&)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x24): undefined reference to boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functionboost::filesystem::directory_entry::status(boost::system::error_code&) const':
grayscaleConvertor.cpp:(.text._ZNK5boost10filesystem15directory_entry6statusERNS_6system10error_codeE[_ZNK5boost10filesystem15directory_entry6statusERNS_6system10error_codeE]+0x31): undefined reference to boost::filesystem::directory_entry::m_get_status(boost::system::error_code*) const'
/tmp/ccRIIPim.o: In functionboost::filesystem::directory_entry::symlink_status(boost::system::error_code&) const':
grayscaleConvertor.cpp:(.text._ZNK5boost10filesystem15directory_entry14symlink_statusERNS_6system10error_codeE[_ZNK5boost10filesystem15directory_entry14symlink_statusERNS_6system10error_codeE]+0x31): undefined reference to boost::filesystem::directory_entry::m_get_symlink_status(boost::system::error_code*) const'
/tmp/ccRIIPim.o: In functionboost::filesystem::detail::dir_itr_imp::~dir_itr_imp()':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem6detail11dir_itr_impD2Ev[_ZN5boost10filesystem6detail11dir_itr_impD5Ev]+0x2e): undefined reference to boost::filesystem::detail::dir_itr_close(void*&, void*&)'
/tmp/ccRIIPim.o: In functionboost::filesystem::directory_iterator::directory_iterator(boost::filesystem::path const&)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem18directory_iteratorC2ERKNS0_4pathE[_ZN5boost10filesystem18directory_iteratorC5ERKNS0_4pathE]+0x4a): undefined reference to boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functionboost::filesystem::directory_iterator::directory_iterator(boost::filesystem::path const&, boost::system::error_code&)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem18directory_iteratorC2ERKNS0_4pathERNS_6system10error_codeE[_ZN5boost10filesystem18directory_iteratorC5ERKNS0_4pathERNS_6system10error_codeE]+0x4b): undefined reference to boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functionboost::filesystem::directory_iterator::increment()':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem18directory_iterator9incrementEv[_ZN5boost10filesystem18directory_iterator9incrementEv]+0xf): undefined reference to boost::filesystem::detail::directory_iterator_increment(boost::filesystem::directory_iterator&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functioncimg_library::cimg::Mutex_info::trylock(unsigned int)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library4cimg10Mutex_info7trylockEj[_ZN12cimg_library4cimg10Mutex_info7trylockEj]+0x1c): undefined reference to pthread_mutex_trylock'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::screen_width()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay12screen_widthEv[_ZN12cimg_library11CImgDisplay12screen_widthEv]+0x26): undefined reference to XOpenDisplay'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay12screen_widthEv[_ZN12cimg_library11CImgDisplay12screen_widthEv]+0x96): undefined reference toXCloseDisplay'
/tmp/ccRIIPim.o: In function cimg_library::CImgDisplay::screen_height()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay13screen_heightEv[_ZN12cimg_library11CImgDisplay13screen_heightEv]+0x26): undefined reference toXOpenDisplay'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay13screen_heightEv[_ZN12cimg_library11CImgDisplay13screen_heightEv]+0x96): undefined reference to XCloseDisplay'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_handle_events(_XEvent const*)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0xb5): undefined reference to XUnmapWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x112): undefined reference toXCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x1f0): undefined reference to XResizeWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x2c2): undefined reference toXCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x317): undefined reference to XGetWindowAttributes'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x335): undefined reference toXSync'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x356): undefined reference to XSetInputFocus'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x472): undefined reference toXCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x5c4): undefined reference to XCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x601): undefined reference toXLookupString'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x635): undefined reference to XQueryKeymap'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x6d8): undefined reference toXLookupString'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x71b): undefined reference to XCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x7f0): undefined reference toXCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x861): undefined reference to XCheckWindowEvent'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_events_thread(void*)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_events_threadEPv[_ZN12cimg_library11CImgDisplay14_events_threadEPv]+0x6a): undefined reference to XCheckTypedEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_events_threadEPv[_ZN12cimg_library11CImgDisplay14_events_threadEPv]+0x94): undefined reference toXCheckMaskEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_events_threadEPv[_ZN12cimg_library11CImgDisplay14_events_threadEPv]+0x14c): undefined reference to pthread_testcancel'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_set_colormap(unsigned long&, unsigned int)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay13_set_colormapERmj[_ZN12cimg_library11CImgDisplay13_set_colormapERmj]+0x2a2): undefined reference to XStoreColors'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_map_window()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay11_map_windowEv[_ZN12cimg_library11CImgDisplay11_map_windowEv]+0x50): undefined reference to XMapRaised'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay11_map_windowEv[_ZN12cimg_library11CImgDisplay11_map_windowEv]+0x74): undefined reference toXWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay11_map_windowEv[_ZN12cimg_library11CImgDisplay11_map_windowEv]+0xcb): undefined reference to XGetWindowAttributes'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay11_map_windowEv[_ZN12cimg_library11CImgDisplay11_map_windowEv]+0xe9): undefined reference toXSync'
/tmp/ccRIIPim.o: In function cimg_library::CImgDisplay::_paint(bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6_paintEb[_ZN12cimg_library11CImgDisplay6_paintEb]+0xcd): undefined reference toXSendEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6_paintEb[_ZN12cimg_library11CImgDisplay6_paintEb]+0x130): undefined reference to XPutImage'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_init_fullscreen()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0xfe): undefined reference to XCreateWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x1df): undefined reference toXCreateImage'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x208): undefined reference to XSelectInput'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x226): undefined reference toXMapRaised'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x24a): undefined reference to XWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x2c1): undefined reference toXPutImage'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x2e6): undefined reference to XGetWindowAttributes'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x304): undefined reference toXSync'
/tmp/ccRIIPim.o: In function cimg_library::CImgDisplay::_desinit_fullscreen()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay19_desinit_fullscreenEv[_ZN12cimg_library11CImgDisplay19_desinit_fullscreenEv]+0x28): undefined reference toXUngrabKeyboard'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay19_desinit_fullscreenEv[_ZN12cimg_library11CImgDisplay19_desinit_fullscreenEv]+0x4d): undefined reference to XDestroyWindow'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_assign(unsigned int, unsigned int, char const*, unsigned int, bool, bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0xf7): undefined reference to XOpenDisplay'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x330): undefined reference toXVisualIDFromVisual'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x34b): undefined reference to XGetVisualInfo'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x392): undefined reference toXFree'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x3d2): undefined reference to pthread_create'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x57c): undefined reference toXCreateWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x5e3): undefined reference to XCreateSimpleWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x614): undefined reference toXSelectInput'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x650): undefined reference to XStoreName'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x6ab): undefined reference toXCreateColormap'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x703): undefined reference to XSetWindowColormap'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x70b): undefined reference toXAllocClassHint'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x741): undefined reference to XSetClassHint'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x74f): undefined reference toXFree'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x84a): undefined reference to XCreateImage'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x870): undefined reference toXInternAtom'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x896): undefined reference to XInternAtom'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x8ce): undefined reference toXSetWMProtocols'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x902): undefined reference to XGrabKeyboard'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::assign()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6assignEv[_ZN12cimg_library11CImgDisplay6assignEv]+0x10c): undefined reference to XDestroyWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6assignEv[_ZN12cimg_library11CImgDisplay6assignEv]+0x17b): undefined reference toXFreeColormap'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6assignEv[_ZN12cimg_library11CImgDisplay6assignEv]+0x198): undefined reference to XSync'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::resize(int, int, bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6resizeEiib[_ZN12cimg_library11CImgDisplay6resizeEiib]+0x208): undefined reference to XResizeWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6resizeEiib[_ZN12cimg_library11CImgDisplay6resizeEiib]+0x227): undefined reference toXGetWindowAttributes'
/tmp/ccRIIPim.o: In function cimg_library::CImgDisplay::move(int, int)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay4moveEii[_ZN12cimg_library11CImgDisplay4moveEii]+0x72): undefined reference toXMoveWindow'
/tmp/ccRIIPim.o: In function void cimg_library::CImgDisplay::_resize<unsigned char>(unsigned char, unsigned int, unsigned int, bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_resizeIhEEvT_jjb[_ZN12cimg_library11CImgDisplay7_resizeIhEEvT_jjb]+0x106): undefined reference toXCreateImage'
/tmp/ccRIIPim.o: In function void cimg_library::CImgDisplay::_resize<unsigned short>(unsigned short, unsigned int, unsigned int, bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_resizeItEEvT_jjb[_ZN12cimg_library11CImgDisplay7_resizeItEEvT_jjb]+0x10b): undefined reference toXCreateImage'
/tmp/ccRIIPim.o: In function void cimg_library::CImgDisplay::_resize<unsigned int>(unsigned int, unsigned int, unsigned int, bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_resizeIjEEvT_jjb[_ZN12cimg_library11CImgDisplay7_resizeIjEEvT_jjb]+0x106): undefined reference toXCreateImage'
/tmp/ccRIIPim.o: In function boost::filesystem::path::path<boost::filesystem::directory_entry>(boost::filesystem::directory_entry const&, boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<boost::filesystem::directory_entry>::type>, void>::type*)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem4pathC2INS0_15directory_entryEEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE[_ZN5boost10filesystem4pathC5INS0_15directory_entryEEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE]+0x21): undefined reference toboost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__cxx11::basic_string, std::allocator >&)'
collect2: error: ld returned 1 exit status
grayscaleConvertor.cpp
#define BOOST_FILESYSTEM_VERSION 3
#define BOOST_FILESYSTEM_NO_DEPRECATED
#include <boost/filesystem.hpp>
#include "CImg.h"
#include <iostream>
#include <string>
using namespace cimg_library;
using namespace std;
namespace fs = ::boost::filesystem;
int main()
{
const string ext = ".png";
fs::path root("/Downloads/testdata1/");
if(!fs::exists(root) || !fs::is_directory(root)) return -1;
fs::recursive_directory_iterator it(root);
fs::recursive_directory_iterator endit;
while(it != endit)
{
if(fs::is_regular_file(*it) && it->path().extension()==ext)
{
CImg<unsigned char> image(it->path().filename().string().c_str()),
gray(image.width(), image.height(), 1, 1, 0),
grayWeight(image.width(), image.height(), 1, 1, 0),
imgR(image.width(), image.height(), 1, 3, 0),
imgG(image.width(), image.height(), 1, 3, 0),
imgB(image.width(), image.height(), 1, 3, 0);
}
++it;
}
return 0;
}

Linking boost::filesystem on Ubuntu 13.04

I am trying to link a project to boost:filesystem on Ubuntu 13.04 and I am geting some weird linking errors in the last stage.
The build configuration is done via cmake:
find_package(Boost COMPONENTS system filesystem program_options REQUIRED )
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})
target_link_libraries(${YARS_TARGET} yarsLib GLEW GL GLU glut m dl xerces-c ode ${Boost_LIBRARIES})
I tried using a different boost version. For 1.49 and 1.53 I have the same behaviour.
On Ubuntu 12.04 it does work just dine and on my development machine running Archlinux with boost 1.53 it compiles, links and runs just fine.
/usr/bin/g++ -O3 CMakeFiles/yars.dir/yarsMain.o -o ../bin/yars
-L/home/vagrant/local/lib -rdynamic ../lib/libyarsLib.a -lGLEW -lGL -lGLU
-lglut -lm -ldl -lxerces-c -lode -lboost_system
-lboost_filesystem -lboost_program_options
../lib/libsensorLib.a ../lib/libenvironmentLib.a ../lib/libutilLib.a ../lib/libutilFilterLib.a ../lib/libutilFormatLib.a ../lib/libutilFunctionGeneratorLib.a ../lib/libutilIoLib.a ../lib/libutilMathLib.a ../lib/libutilDefineLib.a ../lib/libdescriptionLib.a ../lib/libfilterDescriptionLib.a ../lib/libfunctionGeneratorDescriptionLib.a ../lib/libfunctionGeneratorDescriptionUtilLib.a ../lib/libbioDescriptionLib.a ../lib/libsensorsDescriptionLib.a ../lib/libyarsDirectoriesModel.a -Wl,-rpath,/home/vagrant/local/lib:
../lib/libutilIoLib.a(FileSystemOperations.o):
In function `FileSystemOperations::doesDirExist(boost::filesystem::path)':
FileSystemOperations.cpp:(.text+0x27): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x3a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::doesFileExist(boost::filesystem::path)':
FileSystemOperations.cpp:(.text+0x67): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x7a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::doesDirExist(std::string*)':
FileSystemOperations.cpp:(.text+0xca): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o):FileSystemOperations.cpp:(.text+0xdf): more undefined references to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' follow
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDirContainingDir(std::vector<std::string, std::allocator<std::string> >, std::string*)':
FileSystemOperations.cpp:(.text+0x2c3): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x35e): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x373): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x403): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x43b): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x453): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x50d): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x564): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDirContainingFile(std::vector<std::string, std::allocator<std::string> >, std::string*)':
FileSystemOperations.cpp:(.text+0x7e3): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x87e): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x893): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x923): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x95b): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x973): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0xa2d): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0xa84): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDir(std::vector<std::string, std::allocator<std::string> >)':
FileSystemOperations.cpp:(.text+0xd53): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o):FileSystemOperations.cpp:(.text+0xd68): more undefined references to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' follow
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::checkValidPath(std::string*, bool, bool, std::string)':
FileSystemOperations.cpp:(.text+0x1100): undefined reference to `boost::filesystem::detail::initial_path(boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x1124): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x11e9): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x1237): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x130a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x131f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x137b): undefined reference to `boost::filesystem::detail::system_complete(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x13dc): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::checkValidPathFromAlternatives(std::string*, std::string*, std::vector<std::string, std::allocator<std::string> >*, bool, std::string)':
FileSystemOperations.cpp:(.text+0x1635): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x1699): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x16d0): undefined reference to `boost::filesystem::detail::system_complete(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x173f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
Just a suggestion:
1)Check that your boost library contains required symbols, you can use something like this:
nm -D /usr/lib64/libboost_filesystem.so.1.52.0 | grep detail | c++filt | grep your names
2)Try to change order of linking library, for example put -lboost_bla-bla-bla to the end of command line, and run this command with g++ again, not use make or something, just copy paste command and make experiments with it.
I was facing errors like:
filename.cpp:(.text+0x389): undefined reference to boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
filename.cpp:(.text+0x39c): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
obj/x86_64/release/filename.cpp.o: In function `readFromFileNotForm(boost::filesystem::path&, char*, unsigned int)':
filename.cpp:(.text+0x1291): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
obj/x86_64/release/filename.cpp.o: In function `readFromFileForm(boost::filesystem::path&, std::vector<unsigned int, std::allocator<unsigned int> >&)':
filename.cpp:(.text+0x167a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
Other solutions did not work. I wrote this in my cpp file:
#include "boost/filesystem/v3/operations.hpp"
And the problem went away. I guess, it was not able to include it automatically. I also tried with v2, but that did not work, I had to do v3.

What are the ways to run qpid c example without make?

What are the ways to run apache qpid c++ helloworld example without make and by using g++ i need to create an helloworld.o object file how to do these?
g++ -I ./includes/ -o m hello_world.cpp
/tmp/cc9Jao8f.o: In function `main':
hello_world.cpp:(.text+0x169): undefined reference to `qpid::messaging::Connection::Connection(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
hello_world.cpp:(.text+0x178): undefined reference to `qpid::messaging::Connection::open()'
hello_world.cpp:(.text+0x1a1): undefined reference to `qpid::messaging::Connection::createSession(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
hello_world.cpp:(.text+0x1e8): undefined reference to `qpid::messaging::Session::createReceiver(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
hello_world.cpp:(.text+0x205): undefined reference to `qpid::messaging::Session::createSender(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
hello_world.cpp:(.text+0x239): undefined reference to `qpid::messaging::Message::Message(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
hello_world.cpp:(.text+0x254): undefined reference to `qpid::messaging::Sender::send(qpid::messaging::Message const&, bool)'
hello_world.cpp:(.text+0x267): undefined reference to `qpid::messaging::Message::~Message()'
hello_world.cpp:(.text+0x27b): undefined reference to `qpid::messaging::Message::~Message()'
hello_world.cpp:(.text+0x2d6): undefined reference to `qpid::messaging::Duration::SECOND'
hello_world.cpp:(.text+0x2db): undefined reference to `qpid::messaging::operator*(qpid::messaging::Duration const&, unsigned long)'
hello_world.cpp:(.text+0x2f7): undefined reference to `qpid::messaging::Receiver::fetch(qpid::messaging::Duration)'
hello_world.cpp:(.text+0x30d): undefined reference to `qpid::messaging::Message::getContent() const'
hello_world.cpp:(.text+0x366): undefined reference to `qpid::messaging::Session::acknowledge(bool)'
hello_world.cpp:(.text+0x375): undefined reference to `qpid::messaging::Connection::close()'
hello_world.cpp:(.text+0x389): undefined reference to `qpid::messaging::Message::~Message()'
hello_world.cpp:(.text+0x39f): undefined reference to `qpid::messaging::Message::~Message()'
hello_world.cpp:(.text+0x3bb): undefined reference to `qpid::messaging::Sender::~Sender()'
hello_world.cpp:(.text+0x3d2): undefined reference to `qpid::messaging::Sender::~Sender()'
hello_world.cpp:(.text+0x3e8): undefined reference to `qpid::messaging::Receiver::~Receiver()'
hello_world.cpp:(.text+0x3ff): undefined reference to `qpid::messaging::Receiver::~Receiver()'
hello_world.cpp:(.text+0x415): undefined reference to `qpid::messaging::Session::~Session()'
hello_world.cpp:(.text+0x42c): undefined reference to `qpid::messaging::Session::~Session()'
hello_world.cpp:(.text+0x483): undefined reference to `qpid::messaging::Connection::close()'
hello_world.cpp:(.text+0x4b5): undefined reference to `qpid::messaging::Connection::~Connection()'
hello_world.cpp:(.text+0x4cc): undefined reference to `qpid::messaging::Connection::~Connection()'
collect2: ld returned 1 exit status
You just need to link against the library. If the library is called libqpid.so for example, you would add -lqpid to your build command.

build boost c++ 1.48.0 with qt creator

I have been trying to build c++ boost to work with qt creator but until now all what i get is undefined reference to different things things so here is what I did so far:-
I build c++ boost by running bootstrap.bat then bjam
I include the path in my qt creator .pro project
like this
QT += core gui
TARGET = Heap
TEMPLATE = app
INCLUDEPATH += C:\boost\boost_1_48_0
LIBS += -L"C:/boost/boost_1_48_0/stage/lib"
SOURCES += \
main.cpp
HEADERS += \
clss.h \
inputstream.h \
outputstream.h \
myexception.h \
heaptest.h \
comparable.h \
heap.h
FORMS +=
here is my sample code I am testing on
#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;
}
}
and here is the compilation error I get
debug/main.o: In function `cpp_regex_traits_char_layer':
C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/cpp_regex_traits.hpp:366: undefined reference to `boost::re_detail::cpp_regex_traits_char_layer<char>::init()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/regex_raw_buffer.hpp:131: undefined reference to `boost::re_detail::raw_storage::resize(unsigned int)'
debug/main.o: In function `save_state_init':
C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/perl_matcher_non_recursive.hpp:107: undefined reference to `boost::re_detail::get_mem_block()'
debug/main.o: In function `~save_state_init':
C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/perl_matcher_non_recursive.hpp:115: undefined reference to `boost::re_detail::put_mem_block(void*)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/perl_matcher_common.hpp:206: undefined reference to `boost::re_detail::verify_options(unsigned int, boost::regex_constants::_match_flags)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/perl_matcher_non_recursive.hpp:1117: undefined reference to `boost::re_detail::put_mem_block(void*)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/pattern_except.hpp:75: undefined reference to `boost::re_detail::raise_runtime_error(std::runtime_error const&)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_parser.hpp:218: undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_parser.hpp:219: undefined reference to `boost::regex_error::raise() const'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_parser.hpp:219: undefined reference to `boost::regex_error::~regex_error()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_parser.hpp:219: undefined reference to `boost::regex_error::~regex_error()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:798: undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:799: undefined reference to `boost::regex_error::raise() const'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:799: undefined reference to `boost::regex_error::~regex_error()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:799: undefined reference to `boost::regex_error::~regex_error()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:880: undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:881: undefined reference to `boost::regex_error::raise() const'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:881: undefined reference to `boost::regex_error::~regex_error()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:881: undefined reference to `boost::regex_error::~regex_error()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:945: undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:946: undefined reference to `boost::regex_error::raise() const'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:946: undefined reference to `boost::regex_error::~regex_error()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:946: undefined reference to `boost::regex_error::~regex_error()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:1148: undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:1149: undefined reference to `boost::regex_error::raise() const'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:1149: undefined reference to `boost::regex_error::~regex_error()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:1149: undefined reference to `boost::regex_error::~regex_error()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/perl_matcher_non_recursive.hpp:213: undefined reference to `boost::re_detail::get_mem_block()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/cpp_regex_traits.hpp:442: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/cpp_regex_traits.hpp:444: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/basic_regex_creator.hpp:321: undefined reference to `boost::re_detail::raw_storage::insert(unsigned int, unsigned int)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/pending/object_cache.hpp:66: undefined reference to `boost::scoped_static_mutex_lock::scoped_static_mutex_lock(boost::static_mutex&, bool)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/pending/object_cache.hpp:75: undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/pending/object_cache.hpp:75: undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/cpp_regex_traits.hpp:633: undefined reference to `boost::re_detail::lookup_default_collate_name(std::string const&)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/cpp_regex_traits.hpp:675: undefined reference to `boost::re_detail::raise_runtime_error(std::runtime_error const&)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/cpp_regex_traits.hpp:690: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/cpp_regex_traits.hpp:1059: undefined reference to `boost::scoped_static_mutex_lock::scoped_static_mutex_lock(boost::static_mutex&, bool)'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/cpp_regex_traits.hpp:1062: undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()'
debug/main.o:C:\Users\Aamer\Desktop\Heap-build-desktop-Qt_4_8_0__4_8_0__Debug/../../../../boost/boost_1_48_0/boost/regex/v4/cpp_regex_traits.hpp:1062: undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [debug/Heap.exe] Error 1
mingw32-make.exe: *** [debug] Error 2
16:05:31: The process "C:\Qt\qtcreator-2.4.0\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project Heap (target: Desktop)
When executing build step 'Make'
How can I get this to build?
Try changing the LIBS += -L"C:/boost/boost_1_48_0/stage/lib" line to:
LIBS += -L"C:/boost/boost_1_48_0/stage/lib" -lboost_regex
(replace boost_regex with the actual name of the built library (which will probably be something like boost_regex-mgw44-mt-1_48))