I got this figured out. For some reason gmail decided now to show me all the replies to my original thread. This is what I ended up using.

boost::thread thrd(&DataParse::rets_init,dparse,instUUID);

On Wed, Mar 18, 2009 at 1:38 PM, r ottmanj <rottmanj@hsmove.com> wrote:
Even after updating to boost 1.38 I still get this error. This is the current error that I get. Any help with this is greatly appreciated.

g++ -I/local/boost-1.38.0/include/ -I/usr/include/mysql -I/usr/include/Magick++ -I/local/mysql++/include/mysql++ -I/local/config++/include -I/local/librets/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/retsCom.d" -MT"src/retsCom.d" -o"src/retsCom.o" "../src/retsCom.cpp"
../src/retsCom.cpp: In function ‘int main()’:
../src/retsCom.cpp:38: error: ISO C++ forbids taking the address of a bound member function to form a pointer to member function.  Say ‘&DataParse::rets_init’
/local/boost-1.38.0/include/boost/mem_fn.hpp: In member function ‘const R& boost::_mfi::dm<R, T>::call(U&, const void*) const [with U = const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, R = int ()(std::string), T = DataParse]’:
/local/boost-1.38.0/include/boost/mem_fn.hpp:352:   instantiated from ‘const R& boost::_mfi::dm<R, T>::operator()(const U&) const [with U = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, R = int ()(std::string), T = DataParse]’
/local/boost-1.38.0/include/boost/bind.hpp:232:   instantiated from ‘void boost::_bi::list1<A1>::operator()(boost::_bi::type<void>, F&, A&, int) [with F = int (DataParse::*)(std::string), A = boost::_bi::list0, A1 = boost::_bi::value<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]’
/local/boost-1.38.0/include/boost/bind/bind_template.hpp:20:   instantiated from ‘typename boost::_bi::result_traits<R, F>::type boost::_bi::bind_t<R, F, L>::operator()() [with R = void, F = int (DataParse::*)(std::string), L = boost::_bi::list1<boost::_bi::value<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >]’
/local/boost-1.38.0/include/boost/thread/detail/thread.hpp:56:   instantiated from ‘void boost::detail::thread_data<F>::run() [with F = boost::_bi::bind_t<void, int (DataParse::*)(std::string), boost::_bi::list1<boost::_bi::value<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >]’
../src/retsCom.cpp:44:   instantiated from here
/local/boost-1.38.0/include/boost/mem_fn.hpp:333: error: no matching function for call to ‘get_pointer(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)’
make: *** [src/retsCom.o] Error 1

Here is the current version of my code.

main (retsCom.cpp)
#include <iostream>
#include "common/Singleton.h"
#include "config/InitConfig.h"
#include "dbactions/DbConnect.h"

#include <boost/thread/thread.hpp>
#include "parsing/DataParse.h"

using namespace std;

void sayHello(int test){
    cout << test << " HELLO " <<  endl;
}

int main() {

    InitConfig mconfig;

    if(mconfig.setConfig()){
        DbConnect dbConn;
        DataParse dparse;


        // query data base for all instances active or not
        mysqlpp::StoreQueryResult result = dbConn.db_query("select inst_uuid from rcom_instances");

        std::string testtest ="123";
        for (size_t i = 0; i < result.num_rows(); ++i) {
            // init instance variables
            boost::thread thrd(&dparse.rets_init,testtest);
            thrd.join();
        }
    }
    return 0;
}

DataParse.cpp
#include "DataParse.h"




    DataParse::DataParse(){
    }



    int DataParse::rets_init(std::string instanceUUID){
        DbConnect dbConn;


        // create query string
        std::string sqlquery = "SELECT "
                                    "rcom_instances.username as instUser, "
                                    "rcom_instances.userpass as instPass, "
                                    "rcom_instances.login_uri as instURI, "
                                    "rcom_client.username as cliUser, "
                                    "rcom_client.userpass as cliPass, "
                                    "rcom_client.hostname as cliHost, "
                                    "rcom_client.datasource as cliSource "
                                "FROM "
                                    "rcom_instances "
                                    "Inner Join rcom_client ON rcom_instances.inst_uuid = rcom_client.inst_uuid "
                                "WHERE "
                                    "rcom_instances.inst_uuid = '" + instanceUUID + "'";

        // Query db server for rets info
        mysqlpp::StoreQueryResult result = dbConn.db_query(sqlquery.c_str());
        std::cout << result.num_fields() << std::endl;


        iActions.setClientDatasource(dbConn.mysqlStringToString(result[0][0]));
        std::cout << iActions.getClientDatasource() << std::endl;
        parse_test();
        return 0;
    }

    int DataParse::parse_test(){
        std::cout << '\t' << '\t' << iActions.getClientDatasource() << std::endl;
        return 0;
    }

DataParse.h
#ifndef DATAPARSE_H_
#define DATAPARSE_H_
#include <string>
#include <iostream>
#include "../config/InstConfig.h"
#include "../dbactions/DbConnect.h"

class DataParse {
InstConfig iActions;
public:
    DataParse();
    int rets_init(std::string instanceUUID);
    int parse_test();
};

#endif /* DATAPARSE_H_ */


On Mon, Mar 16, 2009 at 8:52 AM, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG


r ottmanj wrote:
I am working on an application that takes use of boost::thread. During the
initial method of my application I need to pass one argument to the method.
As per the api documentation for boost::thread I am using the following:

boost::thread dataThread(dparse.dataMain,instUUID);
dataThread.join();

However, when I attempt to use this, I get the following exception from my
compiler. Is there something that I am missing? I do not see how my thread
constructor is any different from the constructor in the api documentation.

Any help with this is greatly appreciated.

error: no matching function for call to ‘boost::thread::thread(<unresolved
overloaded function type>, std::string&)’
/usr/include/boost/thread/thread.hpp:38: note: candidates are:
boost::thread::thread(const boost::function0<void,
std::allocator<boost::function_base> >&)
/usr/include/boost/thread/thread.hpp:37: note:
boost::thread::thread()
/usr/include/boost/thread/thread.hpp:35: note:
boost::thread::thread(const boost::thread&)
 

It looks like you have an older version of Boost that
doesn't support extra arguments to the constructor.
You'll need to use Boost.Bind.

In Christ,
Steven Watanabe


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users