// Scriptmanager.h
#ifndef _SCRIPTMANAGER_H_
#define _SCRIPTMANAGER_H_
#pragma once
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
class CScriptManager
{
public:
CScriptManager ( );
~CScriptManager( );
// Init ( )
//
// Initialize LUA and standard libraries.
bool Init ( );
private:
lua_State *mState;
};
#endif
// Scriptmanager.cpp
#include "GAF_ScriptManager.h"
CScriptManager::CScriptManager ( )
{
// mState = 0;
}
CScriptManager::~CScriptManager ( )
{
}
bool CScriptManager::Init ( )
{
mState = lua_open ( );
if ( mState == 0 )
return false;
lua_baselibopen(mState);
lua_iolibopen(mState);
lua_strlibopen(mState);
lua_mathlibopen(mState);
return true;
}
This code compiles ok on its own, in a win32 console application. It is only when i add the class to our main game project that the errors occur.
I thought it might possibly be a conflict with DirectX, as we use dshow, dinput, dmusic, ect.. So i one, by one, inlcluded each DX header and library file in my compiling program. I could not get the error to repeat. It seems it only occurs in the project.
I have dug through the docs, wiki, and searched all i can to find possible conflicts with lua - but nothing that resembles the problems i am currently having.
Any and all help will be greatly appreciated,
Thanks,
-gf
LUA Linker Errors
Hi all,
I am currently getting linker errors with lua. I attempting to use lua in a Direct3D application. Here are the linker errors i am getting:
GradeSchoolWars error LNK2005: ___endstdio already defined in LIBCD.lib(_file.obj)
GradeSchoolWars error LNK2005: ___initstdio already defined in LIBCD.lib(_file.obj)
GradeSchoolWars error LNK2005: ___iob_func already defined in LIBCD.lib(_file.obj)
GradeSchoolWars error LNK2005: __cflush already defined in LIBCD.lib(_file.obj)
GradeSchoolWars error LNK2005: __iob already defined in LIBCD.lib(_file.obj)
GradeSchoolWars fatal error LNK1169: one or more multiply defined symbols found
GradeSchoolWars warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
I have all the lua library files included in my resource files.
Here is the code that uses lua:
July 22, 2004 04:34 PM
LIBCMT has to do with multithreading.
The error you are getting happens in projects including non-multithreaded libraries in a multithreaded project.
It can also happen when you are including debug libs in a release build and vice-versa.
Recompile the lua libraries with the same release settings as the application you are trying to compile.
The error you are getting happens in projects including non-multithreaded libraries in a multithreaded project.
It can also happen when you are including debug libs in a release build and vice-versa.
Recompile the lua libraries with the same release settings as the application you are trying to compile.
I am having the same problem as the OP.
When compiling the static libs for Lua, they should they be mutli-threaded, and not mutli-threaded-dll correct?
I compiled them with multi-thread and compiled the test app with multi-thread and still the same errors occur, except I get:
test warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
So I tried using /NODEFUALTLIB and I just get a ton of undefined symbol linker errors for every lua function.
I've been trying to get lua to work awhile now and these libs are being a pain in the arse.
When compiling the static libs for Lua, they should they be mutli-threaded, and not mutli-threaded-dll correct?
I compiled them with multi-thread and compiled the test app with multi-thread and still the same errors occur, except I get:
test warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
So I tried using /NODEFUALTLIB and I just get a ton of undefined symbol linker errors for every lua function.
I've been trying to get lua to work awhile now and these libs are being a pain in the arse.
-------------------------Rayoom Sledge Hammer Productions - Programmer
Changing the project settings to multithreaded debug /MTd fixed the problem. i think i understand why now too, thanks!
I also had this same problem, If you use the /NODEFAULTLIB "libname" option where libname is the name of the library listed in the link error it will exclude that one library and it will link properly. If you use /NODEFAULTLIB it will exclude all default libraries and cause several unresolved ref problems.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement