lua-users home
lua-l archive

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


On Thu, Jun 21, 2018 at 12:43 AM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> I'm unable to build luac.exe
> luac.obj : error LNK2005: luaP_opmodes already defined in lopcodes.obj
> luac.exe : fatal error LNK1169: one or more multiply defined symbols found

Why did the linker try to resolve symbols in lopcodes.obj since
presumably  luac.obj is listed before lua.lib?
How are you building luac.exe?


I'm using script based on "etc/luavs.bat" to build Lua under Visual Studio command prompt.
It worked perfectly with all previous versions of Lua.
 
@setlocal
@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE
@set MYLINK=link /nologo
cd src
%MYCOMPILE% /DLUA_BUILD_AS_DLL l*.c
del lua.obj luac.obj
%MYLINK% /DLL /out:lua54.dll l*.obj
%MYCOMPILE% /DLUA_BUILD_AS_DLL lua.c
%MYLINK% /out:lua.exe lua.obj lua54.lib
%MYCOMPILE% l*.c
del lua.obj linit.obj lbaselib.obj ldblib.obj liolib.obj lmathlib.obj loslib.obj ltablib.obj lstrlib.obj loadlib.obj
%MYLINK% /out:luac.exe *.obj
del *.obj
cd ..

 
Should I set the correct order of .obj files for linker invocation?
What is this order?