Can't use cxx::Thread
BogDan
bog_dan_ro at yahoo.com
Sun Jun 2 10:29:21 CEST 2013
Hello,
I tried to create a very simple application that uses cxx::Thread, but I have some link problems:
... Compiling main.o
==> Linking test_cxx_thread
main.o:(.rodata._ZTI10TestThread[_ZTI10TestThread]+0x8): undefined reference to `typeinfo for cxx::Thread'
Also I think it will be cleaner/better for developers if run, execute and shutdown methods will be moved to a protected section.
This is the main.cc content:
///////////////////////////////////////////////
#include <iostream>
#include <l4/cxx/thread>
#include <thread>
class TestThread : public cxx::Thread
{
public:
TestThread():cxx::Thread(true){}
private:
virtual void run()
{
std::cout << "TestThread" << std::endl;
}
};
static void TestStdThread(int param)
{
std::cout << "TestStdThread param:" << param << std::endl;
}
int main(int argc, char ** argv)
{
(void)argc;
(void)argv;
TestThread cxxTh;
cxxTh.start();
std::thread stdTh(TestStdThread, 1);
for (;;)
{
std::cout << "Hello World!" << std::endl;
sleep( 1 );
}
stdTh.join();
}
///////////////////////////////////////////////
This is the Makefile content:
####################################
PKGDIR ?= ../..
L4DIR ?= $(PKGDIR)/../..
TARGET = test_cxx_thread
SRC_CC = main.cc
CXXFLAGS += -std=c++11
REQUIRES_LIBS = cxx_thread cxx_libc_io cxx_io libstdc++ libpthread
include $(L4DIR)/mk/prog.mk
####################################
Yours,
BogDan.
More information about the l4-hackers
mailing list