AlliedModders

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

Afronanny 01-18-2013 15:28

SH_DECL_HOOK2 errors
 
I'm actually not sure what's wrong here. This line of code should be fine, but MSVC is giving me a million errors. These errors show up no matter where I put this line of code in the file, and removing this line also removes the compile errors.

Code:

SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
The errors are:
Code:

1>..\blazeit_mm.cpp(13): error C2589: 'string' : illegal token on right side of '::'
1>..\blazeit_mm.cpp(13): error C2589: 'string' : illegal token on right side of '::'
1>..\blazeit_mm.cpp(13): warning C4091: 'typedef ' : ignored on left of 'int' when no variable is declared
1>..\blazeit_mm.cpp(13): error C2143: syntax error : missing ';' before '::'
1>..\blazeit_mm.cpp(13): error C2143: syntax error : missing ';' before '::'
1>..\blazeit_mm.cpp(13): error C2065: 'my_rettype' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2146: syntax error : missing ';' before identifier 'orig_ret'
1>..\blazeit_mm.cpp(13): error C2065: 'orig_ret' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2065: 'my_rettype' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2146: syntax error : missing ';' before identifier 'override_ret'
1>..\blazeit_mm.cpp(13): error C2065: 'override_ret' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2065: 'my_rettype' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2146: syntax error : missing ';' before identifier 'plugin_ret'
1>..\blazeit_mm.cpp(13): error C2065: 'plugin_ret' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2065: 'orig_ret' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2065: 'override_ret' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2065: 'plugin_ret' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2061: syntax error : identifier 'my_rettype'
1>..\blazeit_mm.cpp(13): error C2065: 'orig_ret' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2065: 'orig_ret' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2065: 'override_ret' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2065: 'plugin_ret' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2061: syntax error : identifier 'my_rettype'
1>..\blazeit_mm.cpp(13): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\blazeit_mm.cpp(13): error C2143: syntax error : missing ';' before '*'
1>..\blazeit_mm.cpp(13): error C2065: 'retptr' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\blazeit_mm.cpp(13): error C2061: syntax error : identifier 'my_rettype'
1>..\blazeit_mm.cpp(13): error C2065: 'retptr' : undeclared identifier
1>..\blazeit_mm.cpp(13): error C2589: 'string' : illegal token on right side of '::'
1>..\blazeit_mm.cpp(13): error C2143: syntax error : missing '}' before '::'
1>..\blazeit_mm.cpp(13): error C2143: syntax error : missing '}' before '::'
1>..\blazeit_mm.cpp(13): error C2143: syntax error : missing ';' before '::'
1>..\blazeit_mm.cpp(13): error C2059: syntax error : '::'
1>..\blazeit_mm.cpp(13): error C2143: syntax error : missing ';' before '}'
1>..\blazeit_mm.cpp(13): error C2059: syntax error : '}'
1>..\blazeit_mm.cpp(13): error C2589: 'string' : illegal token on right side of '::'
1>..\blazeit_mm.cpp(13): error C2589: 'string' : illegal token on right side of '::'
1>..\blazeit_mm.cpp(13): error C2143: syntax error : missing '}' before '::'
1>..\blazeit_mm.cpp(13): error C2143: syntax error : missing '}' before '::'
1>..\blazeit_mm.cpp(13): error C2143: syntax error : missing ';' before '::'
1>..\blazeit_mm.cpp(13): error C2059: syntax error : '::'

Can anybody offer insight on the source of these errors, and perhaps what to do about it?

Old and Slow 01-20-2013 09:10

Re: SH_DECL_HOOK2 errors
 
First guess is that something is not being included. I was able to drop your code line into one of my MM:S plugins and it still compiled using VS2005. Haven't tried it on VS2008 or VS2010 but suspect it would still compile.

I do include "MRecipientFilter.h" which includes "irecipientfilter.h"

It looks like you want to hook "engine->UserMessageBegin" but do you just need to implement something like "SayText" which doesn't require hooking?


All times are GMT -4. The time now is 14:49.

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