| | |
C++ A Few Errors
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2006
Posts: 37
Reputation:
Solved Threads: 0
When i compile this code i get a few errors (i guess are simple for you guys)
Errors
C++ Syntax (Toggle Plain Text)
void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) { { DWORD OldProt; VirtualProtect((void*) MemOffset, dataLen, PAGE_EXECUTE_READWRITE, &OldProt); RtlMoveMemory((void*) MemOffset, (const void*) DataPtr, dataLen); VirtualProtect((void*) MemOffset, dataLen, OldProt, &OldProt); } void EnableHack(BYTE* AddrToChange, BYTE* To, DWORD len); { for(DWORD i = 0; i < len; i++) WriteMem((DWORD)AddrToChange+i, (DWORD)To+i, 1); }
Errors
C++ Syntax (Toggle Plain Text)
--------------------Configuration: DLL - Win32 Debug-------------------- Compiling... Main.cpp error C2601: 'WriteMem' : local function definitions are illegal error C2601: 'Initialize' : local function definitions are illegal error C2601: 'Shutdown' : local function definitions are illegal error C2601: 'DllMain' : local function definitions are illegal fatal error C1004: unexpected end of file found Error executing cl.exe. DLL.dll - 5 error(s), 0 warning(s)
•
•
Join Date: Aug 2006
Posts: 37
Reputation:
Solved Threads: 0
LOL im so dumb not to see that! i must be blind but... now i have these
C++ Syntax (Toggle Plain Text)
--------------------Configuration: DLL - Win32 Debug-------------------- Compiling... Main.cpp error C2601: 'WriteMem' : local function definitions are illegal error C2065: 'len' : undeclared identifier warning C4018: '<' : signed/unsigned mismatch error C2065: 'AddrToChange' : undeclared identifier error C2065: 'To' : undeclared identifier Error executing cl.exe. DLL.dll - 4 error(s), 1 warning(s)
•
•
Join Date: Aug 2006
Posts: 37
Reputation:
Solved Threads: 0
Now i have like the most errors ever.
My Code
C++ Syntax (Toggle Plain Text)
--------------------Configuration: DLL - Win32 Debug-------------------- Compiling... Main.cpp error C2065: 'MemOffset' : undeclared identifier error C2065: 'dataLen' : undeclared identifier error C2065: 'DataPtr' : undeclared identifier error C2065: 'len' : undeclared identifier warning C4018: '<' : signed/unsigned mismatch error C2065: 'AddrToChange' : undeclared identifier error C2065: 'To' : undeclared identifier error C2143: syntax error : missing ';' before 'else' error C2143: syntax error : missing ';' before '{' error C2447: missing function header (old-style formal list?) error C2143: syntax error : missing ';' before 'else' error C2143: syntax error : missing ';' before '{' error C2447: missing function header (old-style formal list?) error C2143: syntax error : missing ';' before 'else' error C2143: syntax error : missing ';' before '{' error C2447: missing function header (old-style formal list?) error C2143: syntax error : missing ';' before 'else' error C2143: syntax error : missing ';' before '{' error C2447: missing function header (old-style formal list?) error C2143: syntax error : missing ';' before 'else' error C2143: syntax error : missing ';' before '{' error C2447: missing function header (old-style formal list?) error C2143: syntax error : missing ';' before 'else' error C2143: syntax error : missing ';' before '.' error C2501: 'ZChat__InputDet' : missing storage-class or type specifiers error C2371: 'ZChat__InputDet' : redefinition; different basic types see declaration of 'ZChat__InputDet' error C2143: syntax error : missing ';' before '.' error C2143: syntax error : missing ';' before 'return' error C2143: syntax error : missing ';' before '}' error C2143: syntax error : missing ';' before '}' error C2143: syntax error : missing ';' before '}' error C2143: syntax error : missing ';' before '{' error C2447: missing function header (old-style formal list?) error C2065: 'Initialize' : undeclared identifier Error executing cl.exe. DLL.dll - 33 error(s), 1 warning(s)
My Code
C++ Syntax (Toggle Plain Text)
void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen); { DWORD OldProt; VirtualProtect((void*) MemOffset, dataLen, PAGE_EXECUTE_READWRITE, &OldProt); RtlMoveMemory((void*) MemOffset, (const void*) DataPtr, dataLen); VirtualProtect((void*) MemOffset, dataLen, OldProt, &OldProt); } void EnableHack(BYTE* AddrToChange, BYTE* To, DWORD len); for(DWORD i = 0; i < len; i++) WriteMem((DWORD)AddrToChange+i, (DWORD)To+i, 1); }
that's what happens then you fix something :cheesy: look at the first eror message and try to find out why MemOffset is undefined. Where did you define it? It must be in one of two places: (1) a global variable, or (2) a variable declared inside the function in which its used.
Fix one error and it may solve several error messages.
Fix one error and it may solve several error messages.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
First you have this:
and the recomendation was
Now you have:
What changed in the line (and more importantly, why did it change?)
C++ Syntax (Toggle Plain Text)
void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) { ... } void EnableHack(BYTE* AddrToChange, BYTE* To, DWORD len); { for(DWORD i = 0; i < len; i++) WriteMem((DWORD)AddrToChange+i, (DWORD)To+i, 1); }
•
•
•
•
>> void EnableHack(BYTE* AddrToChange, BYTE* To, DWORD len); {
remove the semicolon
C++ Syntax (Toggle Plain Text)
void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen); {
What changed in the line (and more importantly, why did it change?)
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
and first you have this:
and now:
which are both wrong. Is this the implementation of the function or are your just trying to call it and is it part of something else?
regards Niek
C++ Syntax (Toggle Plain Text)
void EnableHack(BYTE* AddrToChange, BYTE* To, DWORD len); { for(DWORD i = 0; i < len; i++) WriteMem((DWORD)AddrToChange+i, (DWORD)To+i, 1); }
C++ Syntax (Toggle Plain Text)
void EnableHack(BYTE* AddrToChange, BYTE* To, DWORD len); for(DWORD i = 0; i < len; i++) WriteMem((DWORD)AddrToChange+i, (DWORD)To+i, 1); }
regards Niek
ok, then you should remove the semicolon as Ancient Dragon allready said.
And in your other function too offcourse, as WaltP pointed out.
regards Niek
C++ Syntax (Toggle Plain Text)
void EnableHack(BYTE* AddrToChange, BYTE* To, DWORD len) { for(DWORD i = 0; i < len; i++) WriteMem((DWORD)AddrToChange+i, (DWORD)To+i, 1); }
And in your other function too offcourse, as WaltP pointed out.
regards Niek
![]() |
Similar Threads
- Simple Programming Errors (Computer Science)
- confused with errors in c++ (C++)
- Windows XP and Corel Suite 8 (WP8) errors (Windows NT / 2000 / XP)
- Loader.EXE and IEDLL.EXE errors (Web Browsers)
- Errors during scandisk (Windows 95 / 98 / Me)
- Upgrading Xp Home to Pro - ERRORS! (Windows NT / 2000 / XP)
- strange annoying errors (Windows NT / 2000 / XP)
- w2k server errors (Windows NT / 2000 / XP)
- Two Problems- "Page Cannot Be Displayed" Errors, Z (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: please help me with this error
- Next Thread: Help Me Solve My Infinite Loop
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






