0
votes

I have an issue compiling my code on windows.

On Unix-based systems all is working fine, but when I compile it on windows (currently with visual studio 2010 express), I'm getting the following errors:

Error 253 error C2146: syntax error : missing ';' before identifier 'N0' C:\ghost++\ghost\ohconnect.h 45

Error 254 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\ghost++\ghost\ohconnect.h 45

Error 255 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\ghost++\ghost\ohconnect.h 45

Error 256 error C2146: syntax error : missing ';' before identifier 'N' C:\ghost++\ghost\ohconnect.h 46

Error 257 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\ghost++\ghost\ohconnect.h 46

And so on. I think it's all relating to my header file, the class itself is made to connect to websockets:

#ifndef OHConnect_H
#define OHConnect_H

//
// OHCONNECT
//

class CTCPClient;
class CBaseGame;
class CCommandPacket;
struct OHCHeader {
  unsigned header_size;
  bool fin;
  bool mask;
  enum opcode_type {
    CONTINUTATION = 0x0,
    TEXT_FRAME = 0x1,
    BINARY_FRAME = 0x2,
    CLOSE = 8,
    PING = 9,
    PONG = 0xa,
  } opcode;
  uint64_t N0;
  uint64_t N;
  uint8_t masking_key[4];
};

In my .cpp file I'm using namespace std; and included <string> only for windows. But all this didnt work so far. I didnt wanted to put the whole files into the question since they are actually long. Here is the full source: Headerfile Mainfile

What did I wrong here?

2
#includeing stdint.h should fix those errors.R Sahu

2 Answers

4
votes

The compiler doesn't know the type uint64_t and uint8_t, add:

#include <cstdint>
2
votes

Note also that the trailing comma in the enum (after the definition PONG = 0xa) was only standardized in C++11, following the change made in C99. Older compilers or those running in a mode following the older 1998/2003 standard may trip over that as well.