Tomasu / LuaGlue

C++11 Lua 5.2 Binding Library
zlib License
79 stars 22 forks source link

Errors in MinGW with GCC 4.8.1 #52

Closed ricanteja closed 10 years ago

ricanteja commented 10 years ago

Doing nothing but including the header luaglue/luaglue.h causes theses errors. This is strange because a while back I remember getting LuaGlue working but it was a different version of LuaGlue and an older version of GCC as well.

In file included from c:\compiler\mingw\include\luaglue\luaglue.h:15:0, from component.cpp:6: c:\compiler\mingw\include\luaglue\luagluesymtab.h: In instantiation of 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int) [with T = LuaGlueClassBase]': c:\compiler\mingw\include\luaglue\luagluesymtab.h:259:41: required from 'const LuaGlueSymTab<LuaGlueClassBase>::Symbol LuaGlueSymTab<LuaGlueClassBase*>::nullSymbol' c:\compiler\mingw\include\luaglue\luagluesymtab.h:229:11: required from 'const LuaGlueSymTab::Symbol& LuaGlueSymTab::findSymint(const char) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luagluesymtab.h:188:27: required from 'T LuaGlueSymTab::lookup(const char, bool) [with T = LuaGlueClassBase_]' c:\compiler\mingw\include\luaglue\luaglue.h:212:45: required from here c:\compiler\mingw\include\luaglue\luagluesymtab.h:68:24: error: 'strdup' was not declared in this scope : name(n ? strdup(n) : nullptr), typeid_name(tn), ptr(p), idx(i), lg_typeid(next_typeid()) ^ mingw32-make: *\ [build] Error 1

Any help appreciated! I know this may very well be a problem with GCC, it wouldn't be the first problem I have encountered with this version..

Tomasu commented 10 years ago

Looks like a derp on my part. if it isn't finding strdup, its because I didn't include the right header. check to see if LuaGlueSymtab.h includes string.h or cstring. if it doesn't include it before LuaGlue.h. It's there in the copy I have, but it may not be in master.

I'm currently working on some large-ish changes to support more types... so I can't push what I have at the moment.. I really should have worked in a new branch.

ricanteja commented 10 years ago

Here are the includes for LuaGlueSymtab.h:

include cstring

include vector

include typeinfo

include random

include chrono

include "LuaGlue/LuaGlueCompat.h"

So cstring is included. Thanks for the quick response.

Tomasu commented 10 years ago

What if you add "using std::strdup;" after those includes?

ricanteja commented 10 years ago

It just says "std::strdup has not been declared"

-edit

Also after that error it continues with the same errors as before

Tomasu commented 10 years ago

Huh. Ok, try including string.h instead of cstring.

ricanteja commented 10 years ago

Continues to fail.

c:\compiler\mingw\include\luaglue\luagluesymtab.h: In constructor 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int)': c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: there are no arguments to 'strdup' that depend on a template parameter, so a declaration of 'strdup' must be available [-fpermissive] : name(n ? strdup(n) : nullptr), typeid_name(tn), ptr(p), idx(i), lg_typeid(next_typeid()) ^ c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luagluesymtab.h: In instantiation of 'const LuaGlueSymTab::Symbol& LuaGlueSymTab::findSymint(const char) [with T = LuaGlueClassBase]': c:\compiler\mingw\include\luaglue\luagluesymtab.h:190:27: required from 'T LuaGlueSymTab::lookup(const char, bool) [with T = LuaGlueClassBase_]' c:\compiler\mingw\include\luaglue\luaglue.h:212:45: required from here c:\compiler\mingw\include\luaglue\luagluesymtab.h:227:36: error: 'strcmp' was not declared in this scope if(strcmp(sym.typeidname, name) == 0) ^ c:\compiler\mingw\include\luaglue\luagluesymtab.h: In instantiation of 'const LuaGlueSymTab::Symbol& LuaGlueSymTab::findSym(const char) [with T = LuaGlueClassBase]': c:\compiler\mingw\include\luaglue\luagluesymtab.h:192:22: required from 'T LuaGlueSymTab::lookup(const char, bool) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luaglue.h:212:45: required from here c:\compiler\mingw\include\luaglue\luagluesymtab.h:210:29: error: 'strcmp' was not declared in this scope if(strcmp(sym.name, name) == 0) ^ In file included from c:\compiler\mingw\include\luaglue\luaglue.h:15:0, from main.hpp:11, from engine.hpp:4, from engine.cpp:1: c:\compiler\mingw\include\luaglue\luagluesymtab.h:10:12: error: 'std::strdup' has not been declared using std::strdup; ^ In file included from c:\compiler\mingw\include\luaglue\luaglue.h:15:0, from main.hpp:11, from engine.hpp:4, from engine.cpp:1: c:\compiler\mingw\include\luaglue\luagluesymtab.h: In constructor 'LuaGlueSymTab::Symbol::Symbol(const char, const char_, T, int)': c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: there are no arguments to 'strdup' that depend on a template parameter, so a declaration of 'strdup' must be available [-fpermissive] : name(n ? strdup(n) : nullptr), typeid_name(tn), ptr(p), idx(i), lg_typeid(next_typeid()) ^ c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luagluesymtab.h: In instantiation of 'const LuaGlueSymTab::Symbol& LuaGlueSymTab::findSymint(const char) [with T = LuaGlueClassBase]': c:\compiler\mingw\include\luaglue\luagluesymtab.h:190:27: required from 'T LuaGlueSymTab::lookup(const char, bool) [with T = LuaGlueClassBase_]' c:\compiler\mingw\include\luaglue\luaglue.h:212:45: required from here c:\compiler\mingw\include\luaglue\luagluesymtab.h:227:36: error: 'strcmp' was not declared in this scope if(strcmp(sym.typeid_name, name) == 0)

ricanteja commented 10 years ago

If you're close to finishing work on your current branch I can wait for you to finish and merge.

ricanteja commented 10 years ago

Good news! I continued to mess with this little problem and discovered it was a compiler issue! Switching the g++ flag "std=c++11" to "std=gnu++11" fixes all compiler error and warnings with no modification to your code! It turns out it wasn't an issue on your side.

Thanks for all your hard work and keep it up!

Tomasu commented 10 years ago

Requiring the use of gnu++11 is a bug in my opinion. I'll look at it. I've changed to using c++11 in my makefile as well, and I just pushed up a change which should fix it. seems using strdup in the initializer list is a worse idea than I originally thought.

ricanteja commented 10 years ago

Hm. The docs over at GCC say that gnu++11 and c++11 are interchangable but they are obviously producing different output. Thanks for the work put into this, I'll try out the latest and see if the problem persists with the c++11 flag. :+1:

ricanteja commented 10 years ago

Welp, unfortunately there are some problems..

These errors are brought on by just including <luaglue/luaglue.h> Here is the version using std=c++11 flag

In file included from c:\compiler\mingw\include\luaglue\LuaGlueStackTemplates.h:8:0, from c:\compiler\mingw\include\luaglue\luaglueapplytuple.h:16, from c:\compiler\mingw\include\luaglue\luagluefunction.h:10, from c:\compiler\mingw\include\luaglue\luaglue.h:13, from main.hpp:11, from component.hpp:4, from component.cpp:1: c:\compiler\mingw\include\luaglue\luaglueutils.h: In destructor 'CxxDemangle::~CxxDemangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] ~CxxDemangle_() { free(realname); } ^ c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:33:15: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] free(realname); ^ c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demanglesym(const char)': c:\compiler\mingw\include\luaglue\luaglueutils.h:43:8: error: 'free' was not declared in this scope free(s); ^ In file included from c:\compiler\mingw\include\luaglue\luaglue.h:15:0, from main.hpp:11, from component.hpp:4, from component.cpp:1: c:\compiler\mingw\include\luaglue\luagluesymtab.h: In constructor 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int)': c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: there are no arguments to 'strdup' that depend on a template parameter, so a declaration of 'strdup' must be available [-fpermissive] name = n ? strdup(n) : nullptr; ^ c:\compiler\mingw\include\luaglue\luagluesymtab.h: In instantiation of 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int) [with T = LuaGlueClassBase_]': c:\compiler\mingw\include\luaglue\luagluesymtab.h:260:41: required from 'const LuaGlueSymTab<LuaGlueClassBase>::Symbol LuaGlueSymTab<LuaGlueClassBase>::nullSymbol' c:\compiler\mingw\include\luaglue\luagluesymtab.h:230:11: required from 'const LuaGlueSymTab::Symbol& LuaGlueSymTab::findSymint(const char) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luagluesymtab.h:189:27: required from 'T LuaGlueSymTab::lookup(const char, bool) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luaglue.h:241:45: required from here c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: 'strdup' was not declared in this scope In file included from c:\compiler\mingw\include\luaglue\LuaGlueStackTemplates.h:8:0, from c:\compiler\mingw\include\luaglue\luaglueapplytuple.h:16, from c:\compiler\mingw\include\luaglue\luagluefunction.h:10, from c:\compiler\mingw\include\luaglue\luaglue.h:13, from main.hpp:11, from engine.hpp:4, from engine.cpp:1: c:\compiler\mingw\include\luaglue\luaglueutils.h: In destructor 'CxxDemangle::~CxxDemangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] ~CxxDemangle() { free(realname); } ^ c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:33:15: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] free(realname); ^ c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demanglesym(const char)': c:\compiler\mingw\include\luaglue\luaglueutils.h:43:8: error: 'free' was not declared in this scope free(s); ^ In file included from c:\compiler\mingw\include\luaglue\luaglue.h:15:0, from main.hpp:11, from engine.hpp:4, from engine.cpp:1: c:\compiler\mingw\include\luaglue\luagluesymtab.h: In constructor 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int)': c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: there are no arguments to 'strdup' that depend on a template parameter, so a declaration of 'strdup' must be available [-fpermissive] name = n ? strdup(n) : nullptr; ^ c:\compiler\mingw\include\luaglue\luagluesymtab.h: In instantiation of 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int) [with T = LuaGlueClassBase_]': c:\compiler\mingw\include\luaglue\luagluesymtab.h:260:41: required from 'const LuaGlueSymTab<LuaGlueClassBase>::Symbol LuaGlueSymTab<LuaGlueClassBase>::nullSymbol' c:\compiler\mingw\include\luaglue\luagluesymtab.h:230:11: required from 'const LuaGlueSymTab::Symbol& LuaGlueSymTab::findSymint(const char) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luagluesymtab.h:189:27: required from 'T LuaGlueSymTab::lookup(const char, bool) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luaglue.h:241:45: required from here c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: 'strdup' was not declared in this scope In file included from c:\compiler\mingw\include\luaglue\LuaGlueStackTemplates.h:8:0, from c:\compiler\mingw\include\luaglue\luaglueapplytuple.h:16, from c:\compiler\mingw\include\luaglue\luagluefunction.h:10, from c:\compiler\mingw\include\luaglue\luaglue.h:13, from main.hpp:11, from entity.hpp:4, from entity.cpp:1: c:\compiler\mingw\include\luaglue\luaglueutils.h: In destructor 'CxxDemangle::~CxxDemangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] ~CxxDemangle() { free(realname); } ^ c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:33:15: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] free(realname); ^ c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demanglesym(const char)': c:\compiler\mingw\include\luaglue\luaglueutils.h:43:8: error: 'free' was not declared in this scope free(s); ^ In file included from c:\compiler\mingw\include\luaglue\luaglue.h:15:0, from main.hpp:11, from entity.hpp:4, from entity.cpp:1: c:\compiler\mingw\include\luaglue\luagluesymtab.h: In constructor 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int)': c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: there are no arguments to 'strdup' that depend on a template parameter, so a declaration of 'strdup' must be available [-fpermissive] name = n ? strdup(n) : nullptr; ^ c:\compiler\mingw\include\luaglue\luagluesymtab.h: In instantiation of 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int) [with T = LuaGlueClassBase_]': c:\compiler\mingw\include\luaglue\luagluesymtab.h:260:41: required from 'const LuaGlueSymTab<LuaGlueClassBase>::Symbol LuaGlueSymTab<LuaGlueClassBase>::nullSymbol' c:\compiler\mingw\include\luaglue\luagluesymtab.h:230:11: required from 'const LuaGlueSymTab::Symbol& LuaGlueSymTab::findSymint(const char) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luagluesymtab.h:189:27: required from 'T LuaGlueSymTab::lookup(const char, bool) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luaglue.h:241:45: required from here c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: 'strdup' was not declared in this scope In file included from c:\compiler\mingw\include\luaglue\LuaGlueStackTemplates.h:8:0, from c:\compiler\mingw\include\luaglue\luaglueapplytuple.h:16, from c:\compiler\mingw\include\luaglue\luagluefunction.h:10, from c:\compiler\mingw\include\luaglue\luaglue.h:13, from main.hpp:11, from main.cpp:1: c:\compiler\mingw\include\luaglue\luaglueutils.h: In destructor 'CxxDemangle::~CxxDemangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] ~CxxDemangle() { free(realname); } ^ c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:33:15: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] free(realname); ^ c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demanglesym(const char)': c:\compiler\mingw\include\luaglue\luaglueutils.h:43:8: error: 'free' was not declared in this scope free(s); ^ In file included from c:\compiler\mingw\include\luaglue\luaglue.h:15:0, from main.hpp:11, from main.cpp:1: c:\compiler\mingw\include\luaglue\luagluesymtab.h: In constructor 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int)': c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: there are no arguments to 'strdup' that depend on a template parameter, so a declaration of 'strdup' must be available [-fpermissive] name = n ? strdup(n) : nullptr; ^ c:\compiler\mingw\include\luaglue\luagluesymtab.h: In instantiation of 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int) [with T = LuaGlueClassBase_]': c:\compiler\mingw\include\luaglue\luagluesymtab.h:260:41: required from 'const LuaGlueSymTab<LuaGlueClassBase>::Symbol LuaGlueSymTab<LuaGlueClassBase>::nullSymbol' c:\compiler\mingw\include\luaglue\luagluesymtab.h:230:11: required from 'const LuaGlueSymTab::Symbol& LuaGlueSymTab::findSymint(const char) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luagluesymtab.h:189:27: required from 'T LuaGlueSymTab::lookup(const char, bool) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luaglue.h:241:45: required from here c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: 'strdup' was not declared in this scope In file included from c:\compiler\mingw\include\luaglue\LuaGlueStackTemplates.h:8:0, from c:\compiler\mingw\include\luaglue\luaglueapplytuple.h:16, from c:\compiler\mingw\include\luaglue\luagluefunction.h:10, from c:\compiler\mingw\include\luaglue\luaglue.h:13, from main.hpp:11, from state.hpp:4, from state.cpp:1: c:\compiler\mingw\include\luaglue\luaglueutils.h: In destructor 'CxxDemangle::~CxxDemangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] ~CxxDemangle() { free(realname); } ^ c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:33:15: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] free(realname); ^ c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demanglesym(const char)': c:\compiler\mingw\include\luaglue\luaglueutils.h:43:8: error: 'free' was not declared in this scope free(s); ^ In file included from c:\compiler\mingw\include\luaglue\luaglue.h:15:0, from main.hpp:11, from state.hpp:4, from state.cpp:1: c:\compiler\mingw\include\luaglue\luagluesymtab.h: In constructor 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int)': c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: there are no arguments to 'strdup' that depend on a template parameter, so a declaration of 'strdup' must be available [-fpermissive] name = n ? strdup(n) : nullptr; ^ c:\compiler\mingw\include\luaglue\luagluesymtab.h: In instantiation of 'LuaGlueSymTab::Symbol::Symbol(const char, const char, T, int) [with T = LuaGlueClassBase_]': c:\compiler\mingw\include\luaglue\luagluesymtab.h:260:41: required from 'const LuaGlueSymTab<LuaGlueClassBase>::Symbol LuaGlueSymTab<LuaGlueClassBase>::nullSymbol' c:\compiler\mingw\include\luaglue\luagluesymtab.h:230:11: required from 'const LuaGlueSymTab::Symbol& LuaGlueSymTab::findSymint(const char) [with T = LuaGlueClassBase]' c:\compiler\mingw\include\luaglue\luagluesymtab.h:189:27: required from 'T LuaGlueSymTab::lookup(const char, bool) [with T = LuaGlueClassBase_]' c:\compiler\mingw\include\luaglue\luaglue.h:241:45: required from here c:\compiler\mingw\include\luaglue\luagluesymtab.h:70:24: error: 'strdup' was not declared in this scope Makefile:33: recipe for target 'build' failed mingw32-make: *\ [build] Error 1

ricanteja commented 10 years ago

And now with the std=gnu++11 flag:

In file included from c:\compiler\mingw\include\luaglue\LuaGlueStackTemplates.h:8:0, from c:\compiler\mingw\include\luaglue\luaglueapplytuple.h:16, from c:\compiler\mingw\include\luaglue\luagluefunction.h:10, from c:\compiler\mingw\include\luaglue\luaglue.h:13, from main.hpp:11, from component.hpp:4, from component.cpp:1: c:\compiler\mingw\include\luaglue\luaglueutils.h: In destructor 'CxxDemangle::~CxxDemangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] ~CxxDemangle_() { free(realname); } ^ c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:33:15: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] free(realname); ^ c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demanglesym(const char)': c:\compiler\mingw\include\luaglue\luaglueutils.h:43:8: error: 'free' was not declared in this scope free(s); ^ In file included from c:\compiler\mingw\include\luaglue\LuaGlueStackTemplates.h:8:0, from c:\compiler\mingw\include\luaglue\luaglueapplytuple.h:16, from c:\compiler\mingw\include\luaglue\luagluefunction.h:10, from c:\compiler\mingw\include\luaglue\luaglue.h:13, from main.hpp:11, from engine.hpp:4, from engine.cpp:1: c:\compiler\mingw\include\luaglue\luaglueutils.h: In destructor 'CxxDemangle::~CxxDemangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] ~CxxDemangle_() { free(realname); } ^ c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:33:15: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] free(realname); ^ c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demanglesym(const char)': c:\compiler\mingw\include\luaglue\luaglueutils.h:43:8: error: 'free' was not declared in this scope free(s); ^ In file included from c:\compiler\mingw\include\luaglue\LuaGlueStackTemplates.h:8:0, from c:\compiler\mingw\include\luaglue\luaglueapplytuple.h:16, from c:\compiler\mingw\include\luaglue\luagluefunction.h:10, from c:\compiler\mingw\include\luaglue\luaglue.h:13, from main.hpp:11, from entity.hpp:4, from entity.cpp:1: c:\compiler\mingw\include\luaglue\luaglueutils.h: In destructor 'CxxDemangle::~CxxDemangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] ~CxxDemangle_() { free(realname); } ^ c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:33:15: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] free(realname); ^ c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demanglesym(const char)': c:\compiler\mingw\include\luaglue\luaglueutils.h:43:8: error: 'free' was not declared in this scope free(s); ^ In file included from c:\compiler\mingw\include\luaglue\LuaGlueStackTemplates.h:8:0, from c:\compiler\mingw\include\luaglue\luaglueapplytuple.h:16, from c:\compiler\mingw\include\luaglue\luagluefunction.h:10, from c:\compiler\mingw\include\luaglue\luaglue.h:13, from main.hpp:11, from main.cpp:1: c:\compiler\mingw\include\luaglue\luaglueutils.h: In destructor 'CxxDemangle::~CxxDemangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] ~CxxDemangle_() { free(realname); } ^ c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:33:15: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] free(realname); ^ c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demanglesym(const char)': c:\compiler\mingw\include\luaglue\luaglueutils.h:43:8: error: 'free' was not declared in this scope free(s); ^ In file included from c:\compiler\mingw\include\luaglue\LuaGlueStackTemplates.h:8:0, from c:\compiler\mingw\include\luaglue\luaglueapplytuple.h:16, from c:\compiler\mingw\include\luaglue\luagluefunction.h:10, from c:\compiler\mingw\include\luaglue\luaglue.h:13, from main.hpp:11, from state.hpp:4, from state.cpp:1: c:\compiler\mingw\include\luaglue\luaglueutils.h: In destructor 'CxxDemangle::~CxxDemangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] ~CxxDemangle_() { free(realname); } ^ c:\compiler\mingw\include\luaglue\luaglueutils.h:20:34: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demangle()': c:\compiler\mingw\include\luaglue\luaglueutils.h:33:15: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available [-fpermissive] free(realname); ^ c:\compiler\mingw\include\luaglue\luaglueutils.h: In function 'std::string lua_demanglesym(const char)': c:\compiler\mingw\include\luaglue\luaglueutils.h:43:8: error: 'free' was not declared in this scope free(s); ^ Makefile:33: recipe for target 'build' failed mingw32-make: _\ [build] Error 1

ricanteja commented 10 years ago

Which version of gcc are you using to build? I've run into strange compiler errors with gcc 4.8.1 that I've never had before and I'm pretty sure it's buggy as all hell.

Tomasu commented 10 years ago

I'm running 4.8.3. Can I get the exact compiler flags you are using so I can compare? I'd like to figure this out.

ricanteja commented 10 years ago

this is the Makefile I wrote for my project

COMPILER = g++ LINKER = ld DEBUGGER = gdb

Lua Paths BUILT_WITH_GCC_4_8_MINGW

LUA_INC = -I C:/Compiler/Lua52/include LUA_LIB = -L C:/Compiler/Lua52/lib -llua

BULLET_INC = -I C:/Compiler/MinGW/lib_bullet/src BULLET_LIB = -L C:/Compiler/MinGW/lib_bullet/lib -lBulletDynamics -lBulletCollision -lLinearMath

SFML Paths BUILT_WITH_GCC_4_7

SFML_INC = -I C:/Compiler/MinGW/lib_sfml/include SFML_LIB = -L C:/Compiler/MinGW/lib_sfml/lib -lsfml-audio-s -lsfml-network-s -lsfml-graphics-s -lsfml-window-s -lsfml-system-s

OpenCV Paths BUILT_WITH_GCC_4_8_MINGW

OPENCV_INC = -I C:/Compiler/MinGW/lib_opencv/include OPENCV_LIB = -L C:/Compiler/MinGW/lib_opencv/lib

INCLUDES = $(LUA_INC) $(BULLET_INC) $(SFML_INC) $(OPENCV_INC) LIBRARIES = $(LUA_LIB) $(BULLET_LIB) $(SFML_LIB) $(OPENCV_LIB) -lpdcurses -lpugixml -lfreetype -ljpeg -lglew -lglew32 -lglu32 -lopengl32 -lgdi32 -lwinmm

Release Flags

RELEASE_FLAGS = -DGLEW_STATIC -DSFML_STATIC -std=gnu++11 -s -O2

Debug Flags

DEBUG_FLAGS = -DGLEW_STATIC -DSFML_STATIC -std=c++11 -Wall -g

Source Files

SOURCE = *.cpp

build: $(SOURCE) @echo compiling release $(COMPILER) $(SOURCE) $(INCLUDES) $(LIBRARIES) $(RELEASE_FLAGS) -o release.exe

debug: $(SOURCE) @echo compiling debug $(COMPILER) $(SOURCE) $(INCLUDES) $(LIBRARIES) $(DEBUG_FLAGS) -o debug.exe

The command run when building is:

compiling release g++ *.cpp -I C:/Compiler/Lua52/include -I C:/Compiler/MinGW/lib_bullet/src -I C:/Compiler/MinGW/lib_sfml/include -I C:/Compiler/MinGW/lib_opencv/include -L C:/Compiler/Lua52/lib -llua -L C:/Compiler/MinGW/lib_bullet/lib -lBulletDynamics -lBulletCollision -lLinearMath -L C:/Compiler/MinGW/lib_sfml/lib -lsfml-audio-s -lsfml-network-s -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -L C:/Compiler/MinGW/lib_opencv/lib -lpdcurses -lpugixml -lfreetype -ljpeg -lglew -lglew32 -lglu32 -lopengl32 -lgdi32 -lwinmm -DGLEW_STATIC -DSFML_STATIC -std=gnu++11 -s -O2 -o release.exe

Tomasu commented 10 years ago

This is what I'm compiling with:

c++   -DLG_DEBUG -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Woverloaded-virtual -Wredundant-decls -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -g -I/home/moose/projects/LuaGlue/include -I/home/moose/projects/LuaGlue/build -I/usr/include/lua5.2 -I/home/moose/projects/LuaGlue/build/examples    -O0 -ggdb3 -Wextra -Wall -pipe -std=c++11 -o CMakeFiles/shared_ptr.dir/shared_ptr.cpp.o -c /home/moose/projects/LuaGlue/examples/shared_ptr.cpp

And I do not have issues. I'll try and continue to look into this... but maybe it is a 4.8.1 mingw bug?

ricanteja commented 10 years ago

I've read a lot of people finding weird quirks with MinGW 4.8.1. For me, code that used to compile just fine now gives strange errors. I have another example of this in another project. I encountered some problems when I tried building bullet physics and when I checked online it turned out to be a 4.8.1 issue. This may very well be the same and just a MinGW 4.8.1 bug.

I'll try your build and see what happens.

ricanteja commented 10 years ago

Hey I finally got around to testing the parameters of your build command and it still gives the same errors as before.

Tomasu commented 10 years ago

This is really weird. I'll look into it more today.

Tomasu commented 10 years ago

Ok, it turns out mingw defines __STRICT_ANSI__ when using -std=c++11, which also makes it not include strdup or seemingly _strdup which is dumb. I've just hacked around that by -U__STRICT_ANSI__ for now. it compiles now. but theres a bug in my last new feature (supporting pointers to basic types) so dont use that for now. I'll probably have to add a wrapper...

Tomasu commented 10 years ago

examples seem to compile under msys2 now. just make sure you have lua installed ;)

ricanteja commented 10 years ago

Sweet! I'll give it a try.

ricanteja commented 10 years ago

The examples were built without a hitch! I think you did it. I think we can finally put this one to rest and close it, do you?

Tomasu commented 10 years ago

Yeah, though im undecided on whether to undefine that in the header or not. seems kindof invasive to me. might just have to be in a readme some place "if you use gcc 4.8.1 on windows, and std=c++11, you may want to undef __STRICT_ANSI__"

ricanteja commented 10 years ago

Ok so the example code built just fine but when I got around to adding LuaGlue to my project again it began to give me errors but now saying I have multiple definitions of 'lua_demangle_sym(char const*)' in each file that includes LuaGlue.h ;

Thanks for the -U STRICT_ANSI fix though, that got rid of all the strdup errors.

Tomasu commented 10 years ago

You can safely comment out lua_demangle_sym in LuaGlueUtils.h, I'll look at that later. its probably not marked inline or something.

ricanteja commented 10 years ago

Yep that did it. It was missing an inline like you said.

Tomasu commented 10 years ago

fixed in master.