Some compile problems

I got 6 compile error's

1
2
3
4
5
6
7
8
9
10
11
Compiling...
cg_syscall.cpp
.\cg_syscall.cpp(16) : error C2059: syntax error : '->'
.\cg_syscall.cpp(18) : error C3861: 'multiVisible': identifier not found
.\cg_syscall.cpp(19) : error C2181: illegal else without matching if
.\cg_syscall.cpp(21) : error C2181: illegal else without matching if
.\cg_syscall.cpp(21) : error C2059: syntax error : '->'
.\cg_syscall.cpp(37) : fatal error C1075: end of file found before the left brace '{' at '.\cg_syscall.cpp(5)' was matched
Build log was saved at "file://c:\Documents and Settings\Administrator Jeroen\Bureaublad\JF_Hook v0.1\Release\BuildLog.htm"
ET_Hook - 6 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


My cg_syscall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "main.h"

int (QDECL *psyscall)(int cmd, ...);
int QDECL osyscall(int cmd, ...)
{
	
	 LPVOID arg[10];
	 va_list arglist;
	 va_start( arglist, cmd );
	 for( int i = 9, j = 0; i > 0; i-- )
		 arg[j++] = va_arg( arglist, LPVOID );
	 va_end( arglist );

	refEntity_t * re = (refEntity_t *)arg[0];

if(cgs_t->clientinfo[re->entityNum].team != cgs_t->clientinfo[cg->clientNum].enemy)
;               {
                    if(!multiVisible(re->entityNum))
                    else re->customShader = 14;
                }
              else if(cgs_t->clientinfo[re->entityNum].team )       ;         {
re->customShader = 16;

	 switch(cmd) 
	 {
	 case CG_R_ADDREFENTITYTOSCENE: 
			if(re->frame)
			{
				re->renderfx |= RF_DEPTHHACK; 

			}
		 break; 
	 }

	 return psyscall(cmd, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9]);
First of all it would be helpful if you could include the main.h in your post.

Second: The compiler messages give you a hint where to look.

For example:
.\cg_syscall.cpp(19) : error C2181: illegal else without matching if


If I look in line 18-19 I see:
1
2
                    if(!multiVisible(re->entityNum))
                    else re->customShader = 14;


You've forogtten to include what to do if the condition is met.
If you don't want to do anything:
either include a single ";"
1
2
3
                    if(!multiVisible(re->entityNum))
                     ; // do nothing
                    else re->customShader = 14;


or (even better) negate the condition and remove the "else"
1
2
                    if(multiVisible(re->entityNum))
                         re->customShader = 14;


The other error messages are also quite simple to interpret. You should try to figure them out by yourself. You'll learn much more if your're trying to find them yourself! If you fail you can still ask...

Failed at the 4 other compile error's cant seem to figure it out...

.\cg_syscall.cpp(16) : error C2059: syntax error : '->'
.\cg_syscall.cpp(18) : error C3861: 'multiVisible': identifier not found
.\cg_syscall.cpp(22) : error C2181: illegal else without matching if
.\cg_syscall.cpp(22) : error C2059: syntax error : '->'



Syscall.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "main.h"

int (QDECL *psyscall)(int cmd, ...);
int QDECL osyscall(int cmd, ...)
{
	
	 LPVOID arg[10];
	 va_list arglist;
	 va_start( arglist, cmd );
	 for( int i = 9, j = 0; i > 0; i-- )
		 arg[j++] = va_arg( arglist, LPVOID );
	 va_end( arglist );

	refEntity_t * re = (refEntity_t *)arg[0];

if(cgs_t->clientinfo[re->entityNum].team != cgs_t->clientinfo[cg->clientNum].enemy)
;               {
                    if(!multiVisible(re->entityNum))
						;
                    else re->customShader = 14;
                }
              else if(cgs_t->clientinfo[re->entityNum].team )    ;        {
			;
			  re->customShader = 16;
			  }
	 switch(cmd) 
	 {
	 case CG_R_ADDREFENTITYTOSCENE: 
			if(re->frame)
			{
				re->renderfx |= RF_DEPTHHACK; 

			}
		 break; 
	 }

	 return psyscall(cmd, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9]); //return the original
}


Main.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#pragma comment(lib, "detours.lib")

#include <windows.h>
#include <detours.h>

//Engine Files
#include "Engine/cg_local.h"


extern int (*pvmMain)( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11  );
int ovmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11  );

extern int (QDECL *psyscall)(int cmd, ...);
int QDECL osyscall(int cmd, ...);
Last edited on
You should remove the ";" in line 17 to remove
error C2181: illegal else without matching if


It seems to me as if the error
error C2059: syntax error : '->'

comes from this fragment
cgs_t->clientinfo
i.e. cgs_t doesn't seem to be a pointer.

The suffix "_t" suggests that it may be a type therefore you maybe need to create an instance of this object (include a line like
cgs_t my_cgs ;
at the beginning of the code) and replace the cgs_t with my_cgs.

But since there are many global variables still hidden in the numerous include files I cannot say for sure...

Error
error C3861: 'multiVisible': identifier not found
sounds like you've forgotten to include a header where this function is declared.
Topic archived. No new replies allowed.