lua-users home
lua-l archive

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

Alexander Gladysh wrote:
Lua *is* supposed to be compilable in C++ mode. To quote manual:

In fact, 5.1.4 compiles fine in C++ mode.

Here is the first error i get from DEV-C++ (the compiler stops but I can get other errors like this one by compiling other files):

g++.exe -c lua-5.2.0-work1/src/lapi.c -o lua-5.2.0-work1/src/lapi.o -I"C:/L/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/L/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/L/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/L/Dev-Cpp/include/c++/3.4.2" -I"C:/L/Dev-Cpp/include" -Wall

lua-5.2.0-work1/src/lapi.c: In function `void lua_arith(lua_State*, int)':
lua-5.2.0-work1/src/lapi.c:303: error: invalid conversion from `int' to `TMS' lua-5.2.0-work1/src/lapi.c:303: error: initializing argument 5 of `void luaV_arith(lua_State*, TValue*, const TValue*, const TValue*, TMS)'

The offending line is:

luaV_arith(L, L->top - 2, L->top - 2, L->top - 1, op - LUA_OPADD + TM_ADD);

casting the last argument to TMS make it compile:

luaV_arith(L, L->top - 2, L->top - 2, L->top - 1, (TMS)(op - LUA_OPADD + TM_ADD));

There are other lines like this in lcode.c (I didn't test further).