probleme compilare Switchbot Sanii/ TC

Înainte de a posta o problemă, caută în acest forum și poate găsești rezolvare.
Închis
Avatar utilizator
yonr1
Nivel 4

Nivel 4
Mesaje: 677
Membru din: 03 Dec 2013, 08:42
Aprecieri: 297  
Mulţumiri: 30  
  Rezolvări prob.: 14
Medalii

*Problemă/Întrebare: am facut ca in tutorial + am comparat cu alt svfiles, nu stiu unde am gresit.....
Tipologie server(PvM / PvP):....
*Resursă folosită: *Link exclusiv J4M* sursa/switchbot-sanii-sloturi-functie-save-t103346.html
*ServerFiles utilizat: ...
*Syserr:

../../common/tables.h: In member function 'bool TSwitchbotAttributeAlternativeTable::IsConfigured() const':
../../common/tables.h:1528: error: a function-definition is not allowed here before ':' token
../../common/tables.h:1537: error: expected primary-expression at end of input
../../common/tables.h:1537: error: expected `;' at end of input
../../common/tables.h:1537: error: expected primary-expression at end of input
../../common/tables.h:1537: error: expected `)' at end of input
../../common/tables.h:1537: error: expected statement at end of input
../../common/tables.h:1537: error: expected `}' at end of input
../../common/tables.h:1537: warning: no return statement in function returning non-void
In file included from OXEvent.cpp:6:
packet.h: In constructor 'TPacketGGSwitchbot::TPacketGGSwitchbot()':
packet.h:2554: error: expected primary-expression before '{' token
packet.h:2554: error: expected `;' before '{' token

packet.h

Cod: Selectaţi tot

#ifdef ENABLE_SWITCHBOT
struct TPacketGGSwitchbot
{
	BYTE bHeader;
	WORD wPort;
	TSwitchbotTable table;

	TPacketGGSwitchbot() : bHeader(HEADER_GG_SWITCHBOT), wPort(0)
	{
		table = {};
	}                                 erroare pe linia asta.
};

enum ECGSwitchbotSubheader
{
	SUBHEADER_CG_SWITCHBOT_START,
	SUBHEADER_CG_SWITCHBOT_STOP,
};

struct TPacketCGSwitchbot
{
	BYTE header;
	int size;
	BYTE subheader;
	BYTE slot;
};

enum EGCSwitchbotSubheader
{
	SUBHEADER_GC_SWITCHBOT_UPDATE,
	SUBHEADER_GC_SWITCHBOT_UPDATE_ITEM,
	SUBHEADER_GC_SWITCHBOT_SEND_ATTRIBUTE_INFORMATION,
};

struct TPacketGCSwitchbot
{
	BYTE header;
	int size;
	BYTE subheader;
	BYTE slot;
};

struct TSwitchbotUpdateItem
{
	BYTE	slot;
	BYTE	vnum;
	BYTE	count;
	long	alSockets[ITEM_SOCKET_MAX_NUM];
	TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
};
#endif

tabels.h

Cod: Selectaţi tot

#ifdef ENABLE_SWITCHBOT
struct TSwitchbotAttributeAlternativeTable
{
	TPlayerItemAttribute attributes[MAX_NORM_ATTR_NUM];

	bool IsConfigured() const
	{
		for (const auto& it : attributes)                       erroare pe linia asta.
		{
			if (it.bType && it.sValue)
			{
				return true;
			}
		}

		return false;
	}
};

struct TSwitchbotTable
{
	DWORD player_id;
	bool active[SWITCHBOT_SLOT_COUNT];
	bool finished[SWITCHBOT_SLOT_COUNT];
	DWORD items[SWITCHBOT_SLOT_COUNT];
	TSwitchbotAttributeAlternativeTable alternatives[SWITCHBOT_SLOT_COUNT][SWITCHBOT_ALTERNATIVE_COUNT];

	TSwitchbotTable() : player_id(0)
	{
		memset(&items, 0, sizeof(items));
		memset(&alternatives, 0, sizeof(alternatives));
		memset(&active, false, sizeof(active));
		memset(&finished, false, sizeof(finished));
	}
};

struct TSwitchbottAttributeTable
{
	BYTE attribute_set;
	int apply_num;
	long max_value;
};
#endif
Ultima oară modificat 14 Iun 2022, 17:20 de către yonr1, modificat 1 dată în total.
Imagine
Afișează semnătura
Avatar utilizator
yonr1
Nivel 4

Nivel 4
Mesaje: 677
Membru din: 03 Dec 2013, 08:42
Aprecieri: 297  
Mulţumiri: 30  
  Rezolvări prob.: 14
Medalii

scz am gresit sectiunea, rog sa o mute cineva.
Imagine
Afișează semnătura
Avatar utilizator
Sathyr
Veteran

Veteran
Mesaje: 1187
Membru din: 14 Feb 2018, 18:23
Regat: Jinno
Aprecieri: 28  
Mulţumiri: 627  
Discord: Copiază ID
 Contact:
Medalii

yonr1 scrie: ↑04 Iun 2022, 15:28 scz am gresit sectiunea, rog sa o mute cineva.
Ți-am mutat eu subiectul în secțiunea corespunzătoare, ai grijă mai mare data viitoare!
Imagine -> official.sathyr
Afișează semnătura
Avatar utilizator
DMG
Membru Club

Membru Club
Mesaje: 632
Membru din: 24 Iun 2017, 14:59
Server: Metin2Haha.ro
Regat: Jinno
Aprecieri: 415  
Mulţumiri: 454  
Medalii

yonr1 scrie: ↑04 Iun 2022, 15:28 scz am gresit sectiunea, rog sa o mute cineva.
Pune fișierele tabels și packet complete sa le vedem , nu doar funcțiile alea . Ca poate ai mai sus o virgula sau ceva în plus/minus unde se blochează și nu îți mai citește funcția de la switch
Imagine
Afișează semnătura
Avatar utilizator
yonr1
Nivel 4

Nivel 4
Mesaje: 677
Membru din: 03 Dec 2013, 08:42
Aprecieri: 297  
Mulţumiri: 30  
  Rezolvări prob.: 14
Medalii

DMG scrie: ↑04 Iun 2022, 15:49
yonr1 scrie: ↑04 Iun 2022, 15:28 scz am gresit sectiunea, rog sa o mute cineva.
Pune fișierele tabels și packet complete sa le vedem , nu doar funcțiile alea . Ca poate ai mai sus o virgula sau ceva în plus/minus unde se blochează și nu îți mai citește funcția de la switch


Imagine
Afișează semnătura
Avatar utilizator
computer1123
Nivel 1

Nivel 1
Mesaje: 81
Membru din: 20 Noi 2017, 23:07
Server: diamond
Regat: Chunjo
Aprecieri: 436  
Mulţumiri: 12  
Medalii

ai facut update la c++? ai nevoie de c++11 daca nu ma insel sau 17

linia asta

for (const auto& it : attributes)

incearca

for (const std::auto& it : attributes)

iar pentru

struct TPacketGGSwitchbot
{
BYTE bHeader;
WORD wPort;
TSwitchbotTable table;

TPacketGGSwitchbot() : bHeader(HEADER_GG_SWITCHBOT), wPort(0)
{
table = {};
} erroare pe linia asta.
};

incearca
struct TPacketGGSwitchbot
{
	BYTE bHeader;
	WORD wPort;
	TSwitchbotTable table;

	TPacketGGSwitchbot() : bHeader(HEADER_GG_SWITCHBOT), wPort(0){
		table = {};};
};
nu am testat si nu stiu daca functioneaza sigur
dar mai bine faci update la sursa
Avatar utilizator
yonr1
Nivel 4

Nivel 4
Mesaje: 677
Membru din: 03 Dec 2013, 08:42
Aprecieri: 297  
Mulţumiri: 30  
  Rezolvări prob.: 14
Medalii

computer1123 scrie: ↑04 Iun 2022, 17:35 ai facut update la c++? ai nevoie de c++11 daca nu ma insel sau 17

linia asta

for (const auto& it : attributes)

incearca

for (const std::auto& it : attributes)

iar pentru

struct TPacketGGSwitchbot
{
BYTE bHeader;
WORD wPort;
TSwitchbotTable table;

TPacketGGSwitchbot() : bHeader(HEADER_GG_SWITCHBOT), wPort(0)
{
table = {};
} erroare pe linia asta.
};

incearca
struct TPacketGGSwitchbot
{
	BYTE bHeader;
	WORD wPort;
	TSwitchbotTable table;

	TPacketGGSwitchbot() : bHeader(HEADER_GG_SWITCHBOT), wPort(0){
		table = {};};
};
nu am testat si nu stiu daca functioneaza sigur
dar mai bine faci update la sursa
../../common/tables.h: In member function 'bool TSwitchbotAttributeAlternativeTable::IsConfigured() const':
../../common/tables.h:1528: error: a function-definition is not allowed here before ':' token
../../common/tables.h:1537: error: expected primary-expression at end of input
../../common/tables.h:1537: error: expected `;' at end of input
../../common/tables.h:1537: error: expected primary-expression at end of input
../../common/tables.h:1537: error: expected `)' at end of input
../../common/tables.h:1537: error: expected statement at end of input
../../common/tables.h:1537: error: expected `}' at end of input
../../common/tables.h:1537: warning: no return statement in function returning non-void
In file included from OXEvent.cpp:6:
packet.h: In constructor 'TPacketGGSwitchbot::TPacketGGSwitchbot()':
packet.h:2554: error: expected primary-expression before '{' token
packet.h:2554: error: expected `;' before '{' token
Imagine
Afișează semnătura
Avatar utilizator
yonr1
Nivel 4

Nivel 4
Mesaje: 677
Membru din: 03 Dec 2013, 08:42
Aprecieri: 297  
Mulţumiri: 30  
  Rezolvări prob.: 14
Medalii

cand compilez db imi da asta

../../common/tables.h: In member function 'bool TSwitchbotAttributeAlternativeTable::IsConfigured() const':
../../common/tables.h:1528: error: a function-definition is not allowed here before ':' token
../../common/tables.h:1537: error: expected primary-expression at end of input
../../common/tables.h:1537: error: expected `;' at end of input
../../common/tables.h:1537: error: expected primary-expression at end of input
../../common/tables.h:1537: error: expected `)' at end of input
../../common/tables.h:1537: error: expected statement at end of input
../../common/tables.h:1537: error: expected `}' at end of input
../../common/tables.h:1537: warning: no return statement in function returning non-void
Imagine
Afișează semnătura
Avatar utilizator
yonr1
Nivel 4

Nivel 4
Mesaje: 677
Membru din: 03 Dec 2013, 08:42
Aprecieri: 297  
Mulţumiri: 30  
  Rezolvări prob.: 14
Medalii

rezolvat, am trecut la g++49
Imagine
Afișează semnătura
Închis

Înapoi la “Probleme rezolvate”

  • Informaţie
  • Cine este conectat

    Utilizatori ce ce navighează pe acest forum: Bing [Bot] și 19 vizitatori