Memory-Hacking-Class icon indicating copy to clipboard operation
Memory-Hacking-Class copied to clipboard

help me

Open armin-mohammadi-codes opened this issue 7 years ago • 5 comments

C:\Users\arminblack\Desktop\Memory>g++ Program.cpp -static -o Program.exe In file included from Program.cpp:3:0: Memory.hpp:2:22: fatal error: stdafx.hpp: No such file or directory #include "stdafx.hpp" ^ compilation terminated.

armin-mohammadi-codes avatar Jan 30 '18 12:01 armin-mohammadi-codes

I used Visual C++ with precompiled headers to build it. That's why I had to use #include "stdafx.hpp". It might work for you if you simply remove that line, but I'm not sure.

T-vK avatar Jan 30 '18 15:01 T-vK

Oh man, it looks like I'll have to make a few changes to the code in order to make it compile with g++. I'll create a new branch with what I got so far tomorrow. I'm currently having an issue linking against psapi.lib, which seems to be called libpsapi.a in Cygwin and is located in /lib/w32api . The #pragma comment(lib, "psapi") seems to be a Visual C++ thing. In theory it should work somewhat like this:
g++ Program.cpp Memory.cpp -static -o Program.exe -llibpsapi

I don't know, maybe you know more than me.

T-vK avatar Jan 30 '18 20:01 T-vK

Created a new branch gcc. You can clone it with git clone -b gcc git://github.com/T-vK/Memory-Hacking-Class.git.

I tried: g++ -llibpsapi -o Example.exe Memory.cpp Example.cpp -static

Which results in:

/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -llibpsapi
collect2: error: ld returned 1 exit status

I tried to add the path to the lib using -L/lib/w32api and also by setting environment variables:

export LIBRARY_PATH=/lib/w32api
export LD_LIBRARY_PATH=/lib/w32api

The result is always the same.

T-vK avatar Jan 31 '18 08:01 T-vK

I managed to get it to compile:

g++ -o Example.exe Memory.cpp Example.cpp -lpsapi -static

Tell me if it works for you.

T-vK avatar Jan 31 '18 11:01 T-vK

I fixed some more bugs. It would be nice if you could try to compile and test Example2.cpp as described in here:
https://github.com/T-vK/Memory-Hacking-Class/tree/gcc

T-vK avatar Jan 31 '18 12:01 T-vK