vandragoon 0 Posted July 29, 2017 Share Posted July 29, 2017 Hi.. I need help with little problem.. i add new pet system and when i try compile server source it give me this error.. can someone help me??? -> main.cpp:483: error: 'temp_exp_line' was not declared in this scope here my main.cpp https://pastebin.com/rdzv7LCP Link to comment Share on other sites More sharing options...
Premium Necro 78 Posted July 29, 2017 Premium Share Posted July 29, 2017 Yeah... Having a source and dont know what i am doing... Find: string temp_exp_line; and NEW_PET define - above -put under .. sorry bad english Link to comment Share on other sites More sharing options...
vandragoon 0 Posted July 29, 2017 Author Share Posted July 29, 2017 still same error Link to comment Share on other sites More sharing options...
Den 46 Posted July 29, 2017 Share Posted July 29, 2017 Before: std::ifstream exppet_table_open("/usr/home/game/share/exppettable.txt"); Add: std::string temp_exp_line; #ifdef NEW_PET_SYSTEM std::string temp_exp_line; std::ifstream exppet_table_open("/usr/home/game/share/exppettable.txt"); /*if (!exp_table_open.is_open()) return 0;*/ int exppet_table_counter = 0; int tmppet_exp = 0; while (!exppet_table_open.eof()) { exppet_table_open >> temp_exp_line; str_to_number(exppet_table_common[exppet_table_counter], temp_exp_line.c_str()); if (exppet_table_common[exppet_table_counter] < 2147483647) { sys_log(0, "Livelli Pet caricati da exppettable.txt: %d !", exppet_table_common[exppet_table_counter]); exppet_table_counter++; } else { fprintf(stderr, "[main] Impossibile caricare la tabella exp valore non valido\n"); break; } } #endif Learn some basics of C++ - it doesn't hurt. Link to comment Share on other sites More sharing options...
vandragoon 0 Posted July 29, 2017 Author Share Posted July 29, 2017 now i have this: main.cpp:497: error: redeclaration of 'std::string temp_exp_line' main.cpp:474: error: 'std::string temp_exp_line' previously declared here Link to comment Share on other sites More sharing options...
Den 46 Posted July 29, 2017 Share Posted July 29, 2017 1 minute ago, vandragoon said: now i have this: main.cpp:497: error: redeclaration of 'std::string temp_exp_line' main.cpp:474: error: 'std::string temp_exp_line' previously declared here Better do it this way: // START_OF_Player_EXP_TABLE_LOADING string temp_exp_line; char szExpTable[256]; snprintf(szExpTable, sizeof(szExpTable), "%s/exp.txt", LocaleService_GetBasePath().c_str()); ifstream exp_table_open(szExpTable); if (!exp_table_open.is_open()) { fprintf(stderr, "Failed to Load ExpTable from %s/exp.txt\n", LocaleService_GetBasePath().c_str()); sys_err("Failed to Load ExpTable from %s/exp.txt", LocaleService_GetBasePath().c_str()); return 0; } int exp_table_counter = 0; while (!exp_table_open.eof()) { exp_table_open >> temp_exp_line; str_to_number(exp_table_common[exp_table_counter], temp_exp_line.c_str()); exp_table_counter++; } fprintf(stderr, "EXP erfolgreich geladen von: %s\n", LocaleService_GetBasePath().c_str()); //sys_log(0, "EXP Table Loaded succsefully from %s", LocaleService_GetBasePath().c_str()); // END_OF_Player_EXP_TABLE_LOADING #ifdef NEW_PET_SYSTEM temp_exp_line = ""; //clearing std::ifstream exppet_table_open("/usr/home/game/share/exppettable.txt"); /*if (!exp_table_open.is_open()) return 0;*/ int exppet_table_counter = 0; int tmppet_exp = 0; while (!exppet_table_open.eof()) { exppet_table_open >> temp_exp_line; str_to_number(exppet_table_common[exppet_table_counter], temp_exp_line.c_str()); if (exppet_table_common[exppet_table_counter] < 2147483647) { sys_log(0, "Livelli Pet caricati da exppettable.txt: %d !", exppet_table_common[exppet_table_counter]); exppet_table_counter++; } else { fprintf(stderr, "[main] Impossibile caricare la tabella exp valore non valido\n"); break; } } #endif You didn't notice you've added something with the same name of variable before. Next time remember to check. Link to comment Share on other sites More sharing options...
vandragoon 0 Posted July 29, 2017 Author Share Posted July 29, 2017 Thanks Den.. its working now Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now