Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译问题 #125

Open
jicewarwick opened this issue Feb 16, 2014 · 5 comments
Open

编译问题 #125

jicewarwick opened this issue Feb 16, 2014 · 5 comments

Comments

@jicewarwick
Copy link

系统: arch-Linux 64 bit

  1. 对于qt5, toscii()不再适用,建议换成toLatin1().
    http://qt-project.org/doc/qt-5.1/qtcore/qstring-obsolete.html#toAscii
    影响文件包括:
    /src/client/client.h
    /src/client/client.cpp
    /src/core/jsonutils.h
    /src/core/engine.cpp
  2. 还有一个问题:
src/core/engine.cpp:1:1: error: ‘include’ does not name a type
 include "engine.h"
 ^
In file included from src/lua/lua.h:16:0,
                 from src/lua/lua.hpp:6,
                 from src/core/engine.cpp:7:
src/lua/luaconf.h:462:21: error: ‘ptrdiff_t’ does not name a type
 #define LUA_INTEGER ptrdiff_t
                     ^
src/lua/lua.h:107:9: note: in expansion of macro ‘LUA_INTEGER’
 typedef LUA_INTEGER lua_Integer;
         ^
In file included from src/lua/lua.hpp:6:0,
                 from src/core/engine.cpp:7:
src/lua/lua.h:169:40: error: ISO C++ forbids declaration of ‘lua_Integer’ with no type [-fpermissive]
 LUA_API lua_Integer     (lua_tointegerx) (lua_State *L, int idx, int *isnum);
                                        ^
src/lua/lua.h:169:40: warning: ‘lua_Integer’ initialized and declared ‘extern’ [enabled by default]
src/lua/lua.h:169:26: error: ‘lua_tointegerx’ was not declared in this scope
 LUA_API lua_Integer     (lua_tointegerx) (lua_State *L, int idx, int *isnum);
                          ^
src/lua/lua.h:169:42: error: expected ‘,’ or ‘;’ before ‘(’ token
 LUA_API lua_Integer     (lua_tointegerx) (lua_State *L, int idx, int *isnum);
                                          ^
src/lua/lua.h:207:54: error: ‘lua_Integer’ is not a type
 LUA_API void        (lua_pushinteger) (lua_State *L, lua_Integer n);
                                                      ^
In file included from src/lua/lua.hpp:8:0,
                 from src/core/engine.cpp:7:
src/lua/lauxlib.h:43:42: error: ISO C++ forbids declaration of ‘lua_Integer’ with no type [-fpermissive]
 LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
                                          ^
src/lua/lauxlib.h:43:42: warning: ‘lua_Integer’ initialized and declared ‘extern’ [enabled by default]
src/lua/lauxlib.h:43:42: error: redefinition of ‘int lua_Integer’
In file included from src/lua/lua.hpp:6:0,
                 from src/core/engine.cpp:7:
src/lua/lua.h:169:9: error: ‘int lua_Integer’ previously defined here
 LUA_API lua_Integer     (lua_tointegerx) (lua_State *L, int idx, int *isnum);
         ^
In file included from src/lua/lua.hpp:8:0,
                 from src/core/engine.cpp:7:
src/lua/lauxlib.h:43:25: error: ‘luaL_checkinteger’ was not declared in this scope
 LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
                         ^
src/lua/lauxlib.h:44:40: error: ISO C++ forbids declaration of ‘lua_Integer’ with no type [-fpermissive]
 LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
                                        ^
src/lua/lauxlib.h:44:40: warning: ‘lua_Integer’ initialized and declared ‘extern’ [enabled by default]
src/lua/lauxlib.h:44:40: error: redefinition of ‘int lua_Integer’
In file included from src/lua/lua.hpp:6:0,
                 from src/core/engine.cpp:7:
src/lua/lua.h:169:9: error: ‘int lua_Integer’ previously defined here
 LUA_API lua_Integer     (lua_tointegerx) (lua_State *L, int idx, int *isnum);
         ^
In file included from src/lua/lua.hpp:8:0,
                 from src/core/engine.cpp:7:
src/lua/lauxlib.h:44:25: error: ‘luaL_optinteger’ was not declared in this scope
 LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
                         ^
make: *** [engine.o] Error 1

求解.

@pansz
Copy link
Collaborator

pansz commented Feb 24, 2014

原来是 Qt5 的编译问题啊。你说的那个修改方法,与 Qt4.8 兼容么?

不过就你后面的问题确实挺奇怪的,分明是标准的 lua 编译不过。

可能的原因也是 Qt 5 的原因,因为 QSanguosha.pro 调用 Qt 生成 Makefile,决定了其他部分的编译参数。也许用 Qt 5 生成的 Makefile 对其他部分的编译参数不同。

比较靠谱的应该是先用 Qt 4.8 试试,因为目前整个项目都没有做 Qt 5 的兼容,大家都使用 Qt 4.8。

至于什么时候可能考虑切换到 Qt 5,要问项目其他成员了。

@jicewarwick
Copy link
Author

我试了一下, 用toLatin1() 可以在4.8下编译.

@Fsu0413
Copy link

Fsu0413 commented Mar 7, 2014

@jicewarwick toAscii()本来就是Qt为了兼容以前版本所做的函数。

@YanGuam
Copy link

YanGuam commented Mar 9, 2014

@Fsu0413 qt5已不支持使用toAscii

@Fsu0413
Copy link

Fsu0413 commented Mar 9, 2014

@YanGuam 我知道……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants