|
|
有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.
|
|