Hack Forums
[C] Syntax error: '{' missing before __fastcall. - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] Syntax error: '{' missing before __fastcall. (/showthread.php?tid=6109562)



Syntax error: '{' missing before __fastcall. - oh9od - Sep 16, 2020

While working on a project, I encountered this error (Syntax error: '{' missing before __fastcall.) on the following line of code:

Code
#ifndef _MODULES_H_
#define _MODULES_H_

#include "definizioni.h"
#include "utils.h"

PPEB __fastcall ModGetPEB();  // <- the faulty line of code
long long __fastcall ModGetBase(wchar_t mName);
wchar_t __fastcall ModGetPath(wchar_t mName);
long long __fastcall ModGetFunc(long long ModBase, BYTE FuncName);

#endif // !_MODULES_H_

The first thing I tried to do was checking if there was a missing ';' in utils.h or some sort of syntax error that caused the problem, no luck: everything seems ok.
Then I checked if there were syntax errors somewhere else in the code when ModGetPEB() gets called: again none.

Unless someone has a better idea, I might go line per line in the code to find the syntax error, I don't want to because the program is pretty big and this is like finding a needle in a soccer pitch.


RE: Syntax _error_: '{' missing before __fastcall. - saltycracker - Sep 16, 2020

Well I'd need to know what PPEB is and how its defined.


RE: Syntax _error_: '{' missing before __fastcall. - oh9od - Sep 16, 2020

(Sep 16, 2020 05:41 AM)saltycracker Wrote:  Well I'd need to know what PPEB is and how its defined.

Code
typedef struct _PEB
{
    BYTE InheritedAddrSpace;
    BYTE ReadImgFileExecOptions;
    BYTE Debugged;
    BYTE SpareBool;
    long long Mutant;
    long long ImgBaseAddress;
    PPEB_LDR_DATA LDR;

} PEB, *PPEB;

this is inside utils.h


RE: Syntax _error_: '{' missing before __fastcall. - saltycracker - Sep 16, 2020

I know the GCC's C compiler had the option to produce a file with all the header files expanded in place..

Maybe you could explore that option with your compiler. Note: I can't remember the flag for that option.

https://stackoverflow.com/questions/4900870/can-gcc-output-c-code-after-preprocessing


RE: Syntax _error_: '{' missing before __fastcall. - oh9od - Sep 16, 2020

(Sep 16, 2020 05:59 AM)saltycracker Wrote:  I know the GCC's C compiler had the option to produce a file with all the header files expanded in place..

Maybe you could explore that option with your compiler. Note: I can't remember the flag for that option.

https://stackoverflow.com/questions/4900870/can-gcc-output-c-code-after-preprocessing

Sure I will try, many thanks! ^^


RE: Syntax _error_: '{' missing before __fastcall. - omboml - Sep 16, 2020

Gcc uses __attribute__((fastcall)) to define fastcalll calling convention.
Try #define __attribute__((fastcall)) __fastcall