Win OK Mint fails

This code compiles and runs fine with MinGWTDM-32 on Win 7
But fails on Linux Mint (32bit) with g++ 4.8.2

compiled with g++ -Wall -c "test.cpp"

James

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
typedef char *PCHAR,*LPCH,*PCH,*NPSTR,*LPSTR,*PSTR;
typedef unsigned int UINT;
typedef unsigned long DWORD,ULONG;
typedef unsigned char UCHAR,byte,BYTE;
typedef void *PVOID,*LPVOID;
typedef int BOOL;
typedef unsigned short WORD;
typedef WORD *PWORD,*LPWORD;
typedef int *PINT,*LPINT;

typedef struct _tagWords
{
  PCHAR    pszWord;
  int      iType;
  int   (__cdecl *Emitter)(char *,PINT);
}tagWords, *LPTAGWORDS;


int main(int argc, char **argv)
{
	std::cout << "james" << std::endl;
	return 0;
}
"fails"? There must be some error message that says what in the code is unacceptable to g++ 4.8.2.

Line 16, perhaps?
Yes line 16.


t01.cpp:40:16: error: expected ')' before '*' token
int (__cdecl *Emitter)(char *,PINT);
^
Compilation failed.

The ^ should be pointing at the *
Last edited on
__cdecl

is it a MS thingy?
Yes it is an MS thingy and I should have known but the old brain cells are rapidly diminishing :)

I removed the __cdecl and it compiles with g++ on Linux.
Thanks for the nudge.

James

Registered users can post here. Sign in or register to post.