Alex Rivera | Logout

Is it possible to check whether you are building for 64-bit with Microsoft C Compiler?

Asked 2009-10-30T03:52:22.773
12

Is there a simple preprocessor macro that is defined for a 64-bit build? I thought _WIN64 might have been it, but even when I build a 32-bit target, the parts enclosed in a #ifdef _WIN64 ... #endif are compiled in, and this is causing problems. It's Friday and I can't think straight, but I'm sure I'm overlooking something very simple here. Maybe even something involving sizeof.

Edit
Report

1 Answer

2

Check your project's build properties, particularly the preprocessor section. Are you defining _WIN64 somewhere in WIN32 builds? The sizeof thing probably won't work since you cannot use in a #if test.

answered 2009-10-30T03:59:05.817

Your Answer