0

I am trying to compile an 32 bit application. I am aware of problems with it but that is why its being compiled on 64 bit version.

I am hanging at this problem. Application uses lots of sql stuff.

In sqltypes.h file: (provided by MDAC)

#ifdef _WIN64
typedef INT64           SQLLEN;
typedef UINT64        SQLULEN;
typedef UINT64  SQLSETPOSIROW;
#else
  #define SQLLEN          SQLINTEGER
  #define SQLULEN         SQLUINTEGER
  #define SQLSETPOSIROW   SQLUSMALLINT
#endif
//For Backward compatibility
#ifdef WIN32
  typedef SQLULEN           SQLROWCOUNT;
  typedef SQLULEN           SQLROWSETSIZE;
  typedef SQLULEN           SQLTRANSID;
  typedef SQLLEN            SQLROWOFFSET;
#endif

For some reason when its compiled on 32 bit platform it works great But when I try building it on 64 it goes berserk.

Error 61 error C2146: syntax error : missing ';' before identifier 'SQLLEN' ..\external\microsoft sdk\include\sqltypes.h 50

It does not recognize INT64, UINT64.

Is there something I need to enable so it will work under 64 build process? Missing some #include or #define?

Any help would be great

Thanks

grobartn
  • 3,510
  • 11
  • 40
  • 52
  • 2
    Show which other headers you are #including. Did you #include windows.h first? – Hans Passant Jun 03 '10 at 19:48
  • Are you sure INT64 and UINT64 are defined? On my system, sqltypes.h depend on another header to define them. If your 64-bit system is finding a version of that file which doesn't have those definitions, that would explain the problem. – ThatBlairGuy Jun 03 '10 at 20:47
  • I am pretty sure that is the problem. actually at this point i am sure because once i added typedef before calling sqltypes it works – grobartn Jun 03 '10 at 21:11
  • do you by any chance know how to fix it? which file is responsible to define them? they are defined in BaseTsd.h but who should call that header?? thanks – grobartn Jun 03 '10 at 21:21
  • Stupid question, but you did notice that the code does not get compiled when you are running 32Bit? The #ifdef excludes this in the 32bit mode. Would you mind editing the question to include the #else bit so we can see the difference? – Cobusve Jun 04 '10 at 12:18
  • i added the code for else part and win32. but the issue is that INT64 UINT64 are not being defined on time. Somewhere I need to include that file (they are defined int BaseTsd.h) – grobartn Jun 04 '10 at 13:53

2 Answers2

1

It turned out the problem was that somehow BaseTsd.h was not included (can't believe this is possible)

but as short fix I just included BaseTsd.h manually... i will comment on this answer if i find better solution

grobartn
  • 3,510
  • 11
  • 40
  • 52
1

Use

#include <windows.h>

It contains BaseTsd.h and other relevant Windows-specific definitions.

Hope
  • 1,051
  • 13
  • 17