AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Coding MM:S Plugins & SM Extensions (https://forums.alliedmods.net/forumdisplay.php?f=75)
-   -   static_assert errors when compiling stub_mm (https://forums.alliedmods.net/showthread.php?t=267828)

shortguy 08-02-2015 02:56

static_assert errors when compiling stub_mm
 
Hi there,

I've been trying to compile the stub_mm included with the metamod source files but I can't seem to get around errors relating to static_assert

Code:

In file included from ../core/sourcehook/sourcehook.h:118:0,
                from ../core/ISmmPlugin.h:37,
                from stub_mm.h:18,
                from stub_mm.cpp:16:
../core/sourcehook/FastDelegate.h:181:2: error: identifier ‘static_assert’ is a keyword in C++11 [-Werror=c++0x-compat]
  static_assert(sizeof(InputClass)==sizeof(u) && sizeof(InputClass)==sizeof(Outp
  ^
In file included from ../core/sourcehook/sourcehook.h:118:0,
                from ../core/ISmmPlugin.h:37,
                from stub_mm.h:18,
                from stub_mm.cpp:16:
../core/sourcehook/FastDelegate.h: In function ‘OutputClass fastdelegate::detail::horrible_cast(InputClass)’:
../core/sourcehook/FastDelegate.h:182:29: error: there are no arguments to ‘static_assert’ that depend on a template parameter, so a declaration of ‘static_assert’ must be available [-fpermissive]
    "Can't use horrible cast");
                            ^
../core/sourcehook/FastDelegate.h:182:29: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../core/sourcehook/FastDelegate.h: In static member function ‘static fastdelegate::detail::GenericClass* fastdelegate::detail::SimplifyMemFunc<N>::Convert(X*, XFuncType, GenericMemFuncType&)’:
../core/sourcehook/FastDelegate.h:297:82: error: there are no arguments to ‘static_assert’ that depend on a template parameter, so a declaration of ‘static_assert’ must be available [-fpermissive]
 atic_assert(N >= 100, "Unsupported memeber function pointer on this compiler")

Code:

../core/sourcehook/FastDelegate.h:799:16: error: ‘static_assert’ was not declared in this scope
  static_assert(sizeof(UnvoidStaticFuncPtr)==sizeof(this), "Can't use evil meth

Anyone have any ideas why this would happen? I thought static_assert is a part of c++1X, why would it give me errors that its not declared in the scope.

I have tried using GCC4.1, GCC4.8 and GCC5.2.

Any ideas?

asherkin 08-02-2015 05:16

Re: static_assert errors when compiling stub_mm
 
The Makefile you are using to compile it is not up to date and does not include the required --std=c++11 flag.

shortguy 08-02-2015 06:32

Re: static_assert errors when compiling stub_mm
 
Wow that makes me feel dumb. I should have checked that it actually used c++11 before wondering that.

Should I submit a PR to get this flag merged into the sample projects in the metamod repo?


All times are GMT -4. The time now is 09:34.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.