Can't use cxx::Thread

BogDan <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.