Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

Pewien problem z linkowaniem . LNK 4006

Ostatnio zmodyfikowano 2015-04-23 14:30
Autor Wiadomość
JMII89
Temat założony przez niniejszego użytkownika
Pewien problem z linkowaniem . LNK 4006
» 2015-04-23 12:52:01
Mam pewien problem . Gdy debuguje swój program dostaje pare errorów dotyczących linkowania . Problem jest taki , że nie rozumiem dlaczego dostaje te errory

1>TCharacter.obj : warning LNK4006: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl IntegerToString(int)" (?IntegerToString@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) already defined in TAccount.obj; second definition ignored
1>TCharacter.obj : warning LNK4006: "int __cdecl StringToInteger(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?StringToInteger@@YAHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in TAccount.obj; second definition ignored
1>TCharacter.obj : warning LNK4006: "class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl split(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char)" (?split@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@D@Z) already defined in TAccount.obj; second definition ignored
1>main.obj : warning LNK4006: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl IntegerToString(int)" (?IntegerToString@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) already defined in TAccount.obj; second definition ignored
1>main.obj : warning LNK4006: "int __cdecl StringToInteger(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?StringToInteger@@YAHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in TAccount.obj; second definition ignored
1>main.obj : warning LNK4006: "class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl split(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char)" (?split@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@D@Z) already defined in TAccount.obj; second definition ignored
1>TClient.obj : warning LNK4006: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl IntegerToString(int)" (?IntegerToString@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) already defined in TAccount.obj; second definition ignored
1>TClient.obj : warning LNK4006: "int __cdecl StringToInteger(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?StringToInteger@@YAHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in TAccount.obj; second definition ignored
1>TClient.obj : warning LNK4006: "class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl split(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char)" (?split@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@D@Z) already defined in TAccount.obj; second definition ignored


TCharacter.cpp
C/C++
std::vector < TCharacter > LoadCharacters( TClient * client, TAccount account )
{
    std::vector < TCharacter > temp_vector;
   
    try
    {
        client->Database.stmt = client->Database.con->prepareStatement( "SELECT * FROM tbl_characters WHERE ID = ?" );
        client->Database.stmt->setInt( 1, account.account_id );
        client->Database.res = client->Database.stmt->executeQuery();
       
        while( client->Database.res->next() )
        {
            TCharacter char_temp;
            char_temp.char_slot = client->Database.res->getInt( "Char_Slot" );
            char_temp.char_name = client->Database.res->getString( "Char_Name" );
            char_temp.char_sex = client->Database.res->getInt( "Char_Sex" );
            char_temp.char_hair = client->Database.res->getInt( "Char_Hair" );
            char_temp.char_color = client->Database.res->getInt( "Char_Color" );
            char_temp.char_class = client->Database.res->getInt( "Char_Class" );
            temp_vector.push_back( char_temp );
        }
    }
   
    catch( sql::SQLException & e )
    {
        std::cout << "ERROR ! SQL EXCEPTION : " << e.getSQLStateCStr() << std::endl;
    }
   
    delete client->Database.res;
    delete client->Database.stmt;
   
    return temp_vector;
}

void CreateChar( TClient * client, std::vector < std::string > Packet, TAccount account )
{
    //Char_NEW adsadsasdadsa 2 0 0 2
    //Char_NEW <nick> <slot> <sex> <hair style> <hair color>
   
    std::vector < int > temp_vec;
   
    try
    {
        for( int i = 4; i < Packet.size(); i++ )
        {
            temp_vec.push_back( atoi( Packet[ i ].c_str() ) );
        }
    }
   
    catch(...)
    {
        closesocket( Client[ client->clients ] );
    }
   
    try
    {
        //to jest nieskończone
        client->Database.stmt = client->Database.con->prepareStatement( "INSERT INTO tbl_characters(ID, Char_Slot, Char_Name, Char_Number, Char_Sex, Char_Hair) VALUES (?,?,?,?,?,?)" );
        client->Database.stmt->setInt( 1, account.account_id );
    }
   
    catch( sql::SQLException & e )
    {
        std::cout << "ERROR ! SQL EXCEPTION : " << e.getSQLStateCStr() << std::endl;
    }
   
    delete client->Database.res;
    delete client->Database.stmt;
}

Tylko w TAccount.h includuje Functions.h gdzie jest IntegerToString i StringToInteger a w TCharacter tego nie używam a pisze , że w TCharacter jest już zdefiniowane . wtf ?


P-131320
darko202
» 2015-04-23 14:30:58
https://msdn.microsoft.com​/pl-pl/library/1zzf962b.aspx
LNK4006 : Danym symbol, wyświetlane w postaci urządzone, została zdefiniowana wielokrotnie
P-131324
« 1 »
  Strona 1 z 1