# Building Cheat Engine from source on Windows x64

> Cheat Engine is a development environment focused on modding games and applications for personal use.

I'm using it for an AI Majesty project that's in the works.

### Why build from source?
Cheat Engine is a pain to install. It has ads built into the installer, and Windows Defender will detect the application as malicious, which can cause installation to fail.

### How
1. Install [Lazarus 2.0.10](https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits)<sup id="1">[1](#ft1)</sup>, both the main app and the cross-compilation addon.<sup id="2">[2](#ft2)</sup>
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1654484898755/KS4f1oAkN.png align="left")
1. Launch Lazarus 2.0.10 (optionally in admin mode)
1. Clone the [Cheat Engine repo](https://github.com/cheat-engine/cheat-engine) to `38dce619dd9371819a1e8f649720e5a435042327`<sup id="3">[3](#ft3)</sup>
1. In Lazarus, go to `Project > Open Project` and select `cheat-engine/Cheat Engine/cheatengine.lpi` 
1. We want to compile the x64 version. Go to `Project > Project options...`
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1654457449315/9EcHKhnPn.png align="left")
1. Find `Config and Target`, and change it to `Release 64-Bit`. Click "OK"
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1654457521227/MkpZwEWW4.png align="left")
1. Running the application from Lazarus won't work unless you launched Lazarus in Admin mode. However, you can launch the application from Windows Explorer
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1654458150858/1WuCR3-S0.png align="left")
1. Done!
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1654458248617/-S1lGXDsv.png align="left")

 ---

 1. <span id="ft1"></span>Different versions of Cheat Engine require specific versions of Lazarus to compile correctly. See [this issue](https://github.com/cheat-engine/cheat-engine/issues/2121#issuecomment-1114339653). I have multiple versions of Lazarus installed side-by-side right now, since I'm trying to diagnose issues in different versions. At time of writing, only Lazarus 2.0.10 worked for me
 2. <span id="ft2"></span>The cross-compilation part is only necessary to build x86. At time of writing, this doesn't work for me due to issue [#2197](https://github.com/cheat-engine/cheat-engine/issues/2197)
 3. <span id="ft3"></span>At time of writing, `master` can't create pointer maps. This is caused by issue [#2218](https://github.com/cheat-engine/cheat-engine/issues/2218#issue-1261282502). For me, the LKG commit was `38dce619dd9371819a1e8f649720e5a435042327`

 ---
