lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello all,

I'm having some troubles compiling LuaSQLITE3(0.9.1) with VS2012(Sqlite 3.7.17 and tried both lua 5.1.5 and lua 5.2.2). I'm getting the following
errors from the compiler and honestly I can't figure out what's wrong.

>1>  lsqlite3.c
>>
1>c:\apps\sqlite-lua\lsqlite3.c(1272): error C2275: 'lua_Number' : illegal use of this type as an _expression_
1>          c:\apps\lua-5.2.2\src\lua.h(103) : see declaration of 'lua_Number'
1>c:\apps\sqlite-lua\lsqlite3.c(1272): error C2146: syntax error : missing ';' before identifier 'n'
1>c:\apps\sqlite-lua\lsqlite3.c(1272): error C2065: 'n' : undeclared identifier
1>c:\apps\sqlite-lua\lsqlite3.c(1272): warning C4244: '=' : conversion from 'lua_Number' to 'int', possible loss of data
1>c:\apps\sqlite-lua\lsqlite3.c(1273): error C2065: 'n' : undeclared identifier
1>c:\apps\sqlite-lua\lsqlite3.c(1274): error C2065: 'n' : undeclared identifier
1>c:\apps\sqlite-lua\lsqlite3.c(1617): warning C4244: '=' : conversion from 'lua_Number' to 'int', possible loss of data
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Here's the corresponding part of the source code, it looks OK to me.

 /* setup lua callback call */
    lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_cb);    /* get callback */
    lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_udata); /* get callback user data */
    lua_pushnumber(L, (lua_Number )op);
    lua_pushstring(L, dbname); /* update_hook database name */
    lua_pushstring(L, tblname); /* update_hook database name */
    lua_Number n = (lua_Number)rowid;                              // COMPILER ERROR HERE -LINE 1272
    if (n == rowid)
        lua_pushnumber(L, n);
    else
        lua_pushfstring(L, "%ll", rowid);

I'd appreciate any suggestions.