7

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?

4
  • 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
    Commented Apr 30, 2013 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. Commented Apr 30, 2013 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. Commented May 21, 2013 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 Commented May 21, 2013 at 9:18

1 Answer 1

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?

4
  • you obviously made assumptions about the compiler, so you should add on which compiler (and version) this compiles just fine.
    – 0xC0000022L
    Commented Apr 30, 2013 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++. Commented Apr 30, 2013 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
    Commented Apr 30, 2013 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. Commented Apr 30, 2013 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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