5

I need help to compile Pseudo-C code generated with IDA Pro and the Hex-Rays decompiler plugin. It shows an error on this line:

int (__thiscall *off_401F14)(void *, char); // weak

Error:

error C2143: syntax error : missing ')' before '*'

I don't see any error on that line. What's wrong?

  • Which compiler (and version) are you trying this in? Please edit your question. Also, this looks off-topic as it concerns forward engineering - and yes, I realize that the tool used is mainly used in RCE. – 0xC0000022L Apr 30 '13 at 14:30
  • 2
    @0xC0000022L I agree that the question lack vital information, However, I find this question related to the site. Decompiler are part of the RE process, and compiling the output is absolutly relevant to RE. – Mellowcandle Apr 30 '13 at 19:36
  • it will not solve your problem, of a missing call type, but you should include "defs.h" ( found in the hexrays sdk ) in your file, it contains several macros used by hexrays. – Willem Hengeveld May 21 '13 at 9:16
  • o, and what is wrong, is that '__thiscall' is apparently not defined for your compiler, you should '#define __thiscall' it to nothing to get rid of this specific error – Willem Hengeveld May 21 '13 at 9:18
6

The following code compiles just fine for me as a .cpp file in Visual C++:

int (__thiscall *off_401F14)(void *, char); // weak

int main(int argc, wchar_t* argv[])
{
    return 0;
}

Perhaps you placed the function prototype inside of a function by accident or compiled it as C (file extension .c) file?

| improve this answer | |
  • you obviously made assumptions about the compiler, so you should add on which compiler (and version) this compiles just fine. – 0xC0000022L Apr 30 '13 at 14:07
  • 1
    I didn't make assumptions about his compiler... "error C2143: syntax error : missing ')' before '*'" is a VC++ compiler error, and I tested my code above with VC++. – Jason Geffner Apr 30 '13 at 14:12
  • 1
    it likely is, I agree. But which version? Also it depends (the __thiscall) whether you throw it into a .cpp or a .c file ;) ... you mention neither and neither does the OP. I find the question extremely badly worded. – 0xC0000022L Apr 30 '13 at 14:12
  • 2
    Actually, you raise a very good point. It looks like it could be because the OP was using a .c file instead of a .cpp file. – Jason Geffner Apr 30 '13 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.