View previous topic :: View next topic |
Author |
Message |
HighVoltage How do I cheat?
Reputation: 0
Joined: 04 Dec 2023 Posts: 8
|
Posted: Sat Oct 26, 2024 3:57 pm Post subject: TinyCC CCode Cannot Compile WinAPI Headers |
|
|
Hello, I seem to be having an issue with{$c} / {$ccode} clauses when it comes to #include'ing WinAPI headers; TinyCC just keeps throwing "random" compilation errors for windows headers.
I have tried everything, such as using addCIncludePath(getCheatEngineDir()) and even compileTCCLib() in a {$lua} block prior to enabling the C code, to no avail.
From what I see on the Forums (cannot link URLs), headers such as <winapi.h> should be includable at the very least.
(This is a default Cheat Engine 7.5 installation without any modifications.)
Sample Code:
Quote: |
Code: | {$lua}
if syntaxcheck then return end
path = getCheatEngineDir()
addCIncludePath(path)
addCIncludePath(path .. "include\\")
addCIncludePath(path .. "include\\winapi\\")
compileTCCLib()
{$asm}
[ENABLE]
{$ccode}
#include <windows.h>
{$asm}
[DISABLE] |
|
Error Output:
Quote: |
Not all code is injectable
(C Error :In file included from <string-0>:5:
In file included from C:/Program Files/Cheat Engine
7.5/include/winapi/windows.h:66:
In file included from C:/Program Files/Cheat Engine
7.5/include/winapi/windef.h:122:
In file included from C:/Program Files/Cheat Engine
7.5/include/winnt.h:80:
C:/Program Files/Cheat Engine
7.5/include/winapi/basetsd.h:109: error: function without
file scope cannot be static
)
Are you sure you want to edit it to this?
|
EDIT: It is worth mentioning that the "error" changes (but is still otherwise "random") when I change {$ccode} to {$c} in the aforementioned code:
New Error:
Quote: |
Not all code is injectable
(C Error :In file included from <string-0>:2:
In file included from C:/Program Files/Cheat Engine
7.5/include/winapi/windows.h:66:
In file included from C:/Program Files/Cheat Engine
7.5/include/winapi/windef.h:122:
C:/Program Files/Cheat Engine
7.5/include/winapi/winnt.h:1516: error: invalid operand
reference after %
)
Are you sure you want to edit it to this?
|
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Sat Oct 26, 2024 4:31 pm Post subject: |
|
|
try adding #define NO_OLDNAMES before the include
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
HighVoltage How do I cheat?
Reputation: 0
Joined: 04 Dec 2023 Posts: 8
|
Posted: Sat Oct 26, 2024 4:36 pm Post subject: |
|
|
Dark Byte wrote: | try adding #define NO_OLDNAMES before the include |
Thank you for the quick response, Dark Byte!
Sorry, I forgot to mention that I had tried #define NO_OLDNAMES (following your advise from Forum Topic 5788378); unfortunately, it did not change the errors, both for {$c} and {$ccode}.
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Sat Oct 26, 2024 4:55 pm Post subject: |
|
|
you may have to edit the header files. Looks like the default ones don't work in 7.5 and earlier on 32-bit targets. (64-bit works fine, and next ce version works completely fine as well)
I do recommend not using the includes anyhow as they include unnecessary code when included which will clutter the symboltable. My goto approach is define the function headers I use myself first, so there's no confusion about headers
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
HighVoltage How do I cheat?
Reputation: 0
Joined: 04 Dec 2023 Posts: 8
|
Posted: Sat Oct 26, 2024 5:10 pm Post subject: |
|
|
Dark Byte wrote: | you may have to edit the header files. Looks like the default ones don't work in 7.5 and earlier on 32-bit targets. (64-bit works fine, and next ce version works completely fine as well)
I do recommend not using the includes anyhow as they include unnecessary code when included which will clutter the symboltable. My goto approach is define the function headers I use myself first, so there's no confusion about headers |
I am much obliged; thanks for taking the time to track this bug.
In that case, I'll define the headers manually for now as I continue to await the next C.E. release on your Patreon (hopefully soon!)
|
|
Back to top |
|
 |
|