游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1410|回复: 3

请教lua入门程序link时出错

[复制链接]

2

主题

89

帖子

99

积分

注册会员

Rank: 2

积分
99
发表于 2005-3-17 16:00:00 | 显示全部楼层 |阅读模式
有lua的lib,但link以下程序时报错。
#ifdef __cplusplus
extern "C"
{
#include "lua.h"

#include "lauxlib.h"
#include "lualib.h"
}
#endif

int main(int argc, char *argv[])
{
lua_State *L = lua_open();
luaopen_base(L);
luaopen_io(L);

const char *buf = "print('hello, world!')";

lua_dostring(buf);

lua_close(L);

return 0;
}
报错如下:
Linking...
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in LIBCD.lib(fclose.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: __isctype already defined in LIBCD.lib(isctype.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _sprintf already defined in LIBCD.lib(sprintf.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fflush already defined in LIBCD.lib(fflush.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _exit already defined in LIBCD.lib(crt0dat.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _strtoul already defined in LIBCD.lib(strtol.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _strchr already defined in LIBCD.lib(strchr.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _realloc already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBCD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _strncpy already defined in LIBCD.lib(strncpy.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/test.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

2

主题

89

帖子

99

积分

注册会员

Rank: 2

积分
99
 楼主| 发表于 2005-3-17 16:28:00 | 显示全部楼层

Re:请教lua入门程序link时出错

问题解决,是编译环境设置不正确

24

主题

229

帖子

229

积分

中级会员

Rank: 3Rank: 3

积分
229
发表于 2005-3-17 18:50:00 | 显示全部楼层

Re:请教lua入门程序link时出错

lua是什么?我很菜,多谢拉:)

2

主题

89

帖子

99

积分

注册会员

Rank: 2

积分
99
 楼主| 发表于 2005-3-17 22:20:00 | 显示全部楼层

Re:请教lua入门程序link时出错

脚本
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-24 21:38

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表