Witam. Otóż napotkałem pierwszy problem z moim projektem. Nie zrobiłem nic innego jak skopiowałem struktury ze strony protokołu gadu gadu a już wywala mi błędy że w strukturach powtarza się linijka "int class;/* klasa wiadomości */" Co jest nie tak ? Oto kod i błędy:
Wszystkie linijki odwołują się właśnie do "int class;/* klasa wiadomości */" w każdej strukturze.
Kod:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
struct gg_header {
int type; /* typ pakietu */
int length; /* długość reszty pakietu */
};
struct gg_welcome {
int seed; /* ziarno */
};
struct gg_login80 {
int uin; /* numer Gadu-Gadu */
char language[2]; /* język: "pl" */
char hash_type; /* rodzaj funkcji skrótu hasła */
char hash[64]; /* skrót hasła dopełniony \0 */
int status; /* początkowy status połączenia */
int flags; /* początkowe flagi połączenia */
int features; /* opcje protokołu (0x00000007)*/
int local_ip; /* lokalny adres połączeń bezpośrednich (nieużywany) */
short local_port; /* lokalny port połączeń bezpośrednich (nieużywany) */
int external_ip; /* zewnętrzny adres (nieużywany) */
short external_port; /* zewnętrzny port (nieużywany) */
char image_size; /* maksymalny rozmiar grafiki w KB */
char unknown2; /* 0x64 */
int version_len; /* długość ciągu z wersją (0x21) */
char version[]; /* "Gadu-Gadu Client build 8.0.0.7669" (bez \0) */
int description_size; /* rozmiar opisu */
char description[]; /* opis (nie musi wystąpić, bez \0) */
};
struct gg_login80_ok {
int unknown1; /* 01 00 00 00 */
};
struct gg_send_msg80 {
int recipient; /* numer odbiorcy */
int seq; /* numer sekwencyjny */
int class; /* klasa wiadomości */
int offset_plain; /* położenie treści czystym tekstem */
int offset_attributes; /* położenie atrybutów */
char html_message[]; /* treść w formacie HTML (zakończona \0) */
char plain_message[]; /* treść czystym tekstem (zakończona \0) */
char attributes[]; /* atrybuty wiadomości */
};
struct gg_recv_msg80 {
int sender; /* numer nadawcy */
int seq; /* numer sekwencyjny */
int time; /* czas nadania */
int class; /* klasa wiadomości */
int offset_plain; /* położenie treści czystym tekstem */
int offset_attributes; /* położenie atrybutów */
char html_message[]; /* treść w formacie HTML (zakończona \0) */
char plain_message[]; /* treść czystym tekstem (zakończona \0) */
char attributes[]; /* atrybuty wiadomości */
};
int gg_login_hash(unsigned char *password, unsigned int seed)
{
unsigned int x, y, z;
y = seed;
for (x = 0; *password; password++) {
x = (x & 0xffffff00) | *password;
y ^= x;
y += x;
x <<= 8;
y ^= x;
x <<= 8;
y -= x;
x <<= 8;
y ^= x;
z = y & 0x1f;
y = (y << z) | (y >> (32 - z));
}
return y;
}
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Kod:
Build
[C++ Error] Unit1.h(50): E2176 Too many types in declaration
[C++ Error] Unit1.h(50): E2275 { expected
[C++ Error] Unit1.h(50): E2321 Declaration does not specify a tag or an identifier
[C++ Error] Unit1.h(61): E2176 Too many types in declaration
[C++ Error] Unit1.h(61): E2275 { expected
[C++ Error] Unit1.h(61): E2321 Declaration does not specify a tag or an identifier