Using Visual C++ 2005 Express Edition:
Well I compiled with Lua 5.1 before, and I could compile one of my old projects just fine.
I decided to put the same files into the Source engine. Well it compiled fine, right up to:
[code]2>lua.c
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(324) : warning C4996: 'getenv' was declared deprecated
2> C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\stdlib.h(483) : see declaration of 'getenv'
2> Message: 'This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(369) : error C2143: syntax error : missing ';' before '{'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(370) : error C2065: 'ar' : undeclared identifier
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(376) : error C2143: syntax error : missing ';' before 'type'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(383) : error C2084: function 'void print_usage(void)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(42) : see previous definition of 'print_usage'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(399) : error C2084: function 'void l_message(const char *,const char *)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(58) : see previous definition of 'l_message'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(406) : error C2084: function 'int report(lua_State *,int)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(65) : see previous definition of 'report'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(417) : error C2084: function 'int traceback(lua_State *)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(76) : see previous definition of 'traceback'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(437) : error C2084: function 'int docall(lua_State *,int,int)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(96) : see previous definition of 'docall'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(452) : error C2084: function 'void print_version(void)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(111) : see previous definition of 'print_version'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(457) : error C2084: function 'int getargs(lua_State *,char **,int)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(116) : see previous definition of 'getargs'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(475) : error C2084: function 'int dofile(lua_State *,const char *)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(134) : see previous definition of 'dofile'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(481) : error C2084: function 'int dostring(lua_State *,const char *,const char *)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(140) : see previous definition of 'dostring'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(487) : error C2084: function 'int dolibrary(lua_State *,const char *)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(146) : see previous definition of 'dolibrary'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(494) : error C2084: function 'const char *get_prompt(lua_State *,int)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(153) : see previous definition of 'get_prompt'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(504) : error C2084: function 'int incomplete(lua_State *,int)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(163) : see previous definition of 'incomplete'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(518) : error C2084: function 'int pushline(lua_State *,int)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(177) : see previous definition of 'pushline'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(537) : error C2084: function 'int loadline(lua_State *)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(196) : see previous definition of 'loadline'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(557) : error C2084: function 'void dotty(lua_State *)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(216) : see previous definition of 'dotty'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(580) : error C2084: function 'int handle_script(lua_State *,char **,int)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(239) : see previous definition of 'handle_script'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(602) : error C2084: function 'int collectargs(char **,int *,int *,int *)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(261) : see previous definition of 'collectargs'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(635) : error C2084: function 'int runargs(lua_State *,char **,int)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(294) : see previous definition of 'runargs'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(664) : error C2084: function 'int handle_luainit(lua_State *)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(323) : see previous definition of 'handle_luainit'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(674) : error C2011: 'Smain' : 'struct' type redefinition
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(333) : see declaration of 'Smain'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(681) : error C2084: function 'int pmain(lua_State *)' already has a body
2> ..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(340) : see previous definition of 'pmain'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(737) : error C2040: 'globalL' : 'int' differs in levels of indirection from 'lua_State *'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(737) : error C2065: 'L' : undeclared identifier
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(737) : error C2099: initializer is not a constant
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(738) : error C2059: syntax error : 'if'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(739) : error C2059: syntax error : ','
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(739) : error C2143: syntax error : missing ')' before 'constant'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(739) : error C2143: syntax error : missing '{' before 'constant'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(739) : error C2059: syntax error : '<Unknown>'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(739) : error C2059: syntax error : ')'
1>tier2.lib(tier2.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(740) : error C2371: 'luaL_openlibs' : redefinition; different basic types
2> c:\users\henry\documents\visual studio 2005\projects\hit\hit\lualib.h(44) : see declaration of 'luaL_openlibs'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(741) : error C2059: syntax error : ','
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(741) : error C2143: syntax error : missing ')' before 'constant'
1> Creating library Release HL2MP/client.lib and object Release HL2MP/client.exp
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(741) : error C2143: syntax error : missing '{' before 'constant'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(741) : error C2059: syntax error : '<Unknown>'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(741) : error C2059: syntax error : ')'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(742) : error C2143: syntax error : missing '{' before '->'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(742) : error C2059: syntax error : '->'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(743) : error C2059: syntax error : 'if'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(744) : error C2065: 'argv' : undeclared identifier
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(744) : warning C4047: 'function' : 'char **' differs in levels of indirection from 'int'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(744) : warning C4024: 'collectargs' : different types for formal and actual parameter 1
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(744) : error C2099: initializer is not a constant
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(745) : error C2059: syntax error : 'if'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(750) : error C2059: syntax error : 'if'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(751) : error C2143: syntax error : missing '{' before '->'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(751) : error C2059: syntax error : '->'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(752) : error C2059: syntax error : 'if'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(753) : error C2059: syntax error : 'if'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(755) : error C2059: syntax error : 'if'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(756) : error C2059: syntax error : 'if'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(758) : error C2059: syntax error : 'else'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(765) : error C2059: syntax error : 'return'
2>..\..\..\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\lua.c(766) : error C2059: syntax error : '}'[/code]
Well, I tried recompiling that old project. Same errors. What the fudge?
Then I just thought Microsoft fudged up. And it probably did.
I opened the project into CODE::BLOCKS and converted and everything, it compiles FINE.
I opened up Source and Source is apparently not compatible with CODE::BLOCKS at all. Any ideas?
You added the lua.c and (i'm guessing) luac.c
These contain main functions and should not be used with the Source Engine.
I removed luac.c (Because as I already told you, I had another project before that uses lua. I'm not stupid.)
Do I have to remove lua.c?
Edit: Removed lua.c, it apparently depends on it and still tries to compile it.
You only need to include lua.h and link with lua5.1.lib . You then put lua5.1.dll in the same directory as hl2.exe (or whatever) and it'll find it.
[QUOTE=BoingBoing;17276079]
Edit: Removed lua.c, it apparently depends on it and still tries to compile it.[/QUOTE]
Well then get rid of it, there's not such thing as "depends on it" unless you don't get rid of it.
Sorry, you need to Log In to post a reply to this thread.