I try to compile a simple thread_group-example with Borland
C++ 5.6 for Win32. I get the following link error:
Error: Unresolved external
'boost::thread_group::create_thread(const boost::function0<void,
std::allocator<boost::function_base> >&)' referenced from
C:\BACPP\SERVICEADAPTER\SRC\SERG.OBJ
I have built the boost_thread-bcb-mt-1_34_1.lib with
Bjam and Borland.
The examples can be created with the library.
The MSVC-Variant works without errors.
Link-Call:
C:\Programme\Borland\CBuilder6\BIN\ILINK32 -Tpe -r -ap -Gn
C:\Programme\Borland\CBuilder6\lib\C0X32.OBJ /v -L..\..\Extern\BCB582\BDP\lib
-L..\
..\Xerces\lib\BCB582 -L..\..\Boost\lib\BCB582
-L..\..\LogEngineBA\lib\BCB582 -LC:\Programme\Borland\CBuilder6\lib
serg.obj /LIBPATH:..\..\Extern\BC
B582\BDP\lib orb_br.lib vdlog_br.lib vport_br.lib
/LIBPATH:..\..\Xerces\lib\BCB582 xerces-bor_2_7_0.lib
/LIBPATH:..\..\Boost\lib\BCB582 boost_thread-b
cb-mt-1_34_1.lib
/LIBPATH:..\..\LogEngineBA\lib\BCB582 LogEngine.lib
C:\Programme\Borland\CBuilder6\lib\import32.lib
C:\Programme\Borland\CBuilder6\li
b\cw32mti.lib , serg.exe
Turbo Incremental Link 5.60 Copyright (c) 1997-2002
Borland
Error: Unresolved external
'boost::thread_group::create_thread(const boost::function0<void,
std::allocator<boost::function_base> >&)' referenced from
C:\BACPP\SERVICEADAPTER\SRC\SERG.OBJ
RLINK32 Version 6.00 (c) Copyright 1992-2002
Borland Software Corporation.
Source:
#include <iostream>
#include <stdio>
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
#include <boost/smart_ptr.hpp>
#include <vector>
using namespace std ;
void doCallThreads(std::string text){
printf("Start
Thread .......%s\n", text);
}
void doCallThreadsXXX(){
printf("Start
Thread .......\n");
}
void doCallsWithThreads(const int countThreads){
// std::vector<boost::thread
*> threads;
boost::thread_group
threads;
for(int
i = 0; i<countThreads; i++){
//threads.create_thread(boost::bind(doCallThreads,
"hhh"));
threads.create_thread(&doCallThreadsXXX);
// threads.create_thread(&doCallThreadsXXX);
printf("Thread
%d gestartet\n", (i+1));
}
printf("All
threads started\n");
// Warten bis
alle thread fertig sind
threads.join_all();
printf("All
threads stopped\n");
}
int main(int argc, char* const* argv) {
try {
doCallsWithThreads(5);
cout
<< "ENDE" << endl ;
}
catch(std::exception ex)
{
cout << "Error: "
<< ex.what() << endl ;
throw;
}
catch(...)
{
cout << "Error" ;
throw;
}
return 0 ;
}
Any idea?????