I had the same issue. Make sure you are compiling to the OS, not the chip. If the OS is 32-bit, use the 32 bit compile/link options found here, if the chip and OS are 64-bit, follow the instructions for the 64-bit entry:
https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1056696