有什么方法可以运行apache qpid c ++ helloworld示例而不使用make和使用g ++我需要创建一个helloworld.o目标文件如何做到这些?
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
答案 0 :(得分:1)
您只需要链接到库。例如,如果库名为libqpid.so
,则可以在构建命令中添加-lqpid
。