Usually Microsoft code uses __int64
which is not understood by GCC.
I know I can write it as a macro like this:
#define __int64 long long
But I don't want to do this, due to code portability. I'm trying to give GCC the following Preprocessor Option:
-D__int64="long long"
I get the following error due to the space between the two long
's:
gcc.exe: error: long: No such file or directory
How to fix it ?
The __int64 type is synonymous with type long long .
You can invoke the preprocessor either with the cpp command, or via gcc -E . In GCC, the preprocessor is actually integrated with the compiler rather than a separate program, and both of these commands invoke GCC and tell it to stop after the preprocessing phase.
As other have said signed __int32 is a 32-bit 2's complement integer and unsigned __int32 is a 32-bit unsigned integer. Using __ before int32 to form __int32 makes it a reserved identifier.
The output is in the form of an assembler code file for each non-assembler input file specified. By default, the assembler file name for a source file is made by replacing the suffix ' .
You could use int64_t
, the standard name for that type, but it will only work if the code does #include <stdint.h>
, and that's perhaps hoping for too much.
Otherwise you could try to "sneak" in a typedef
in some common header:
typedef long long __int64;
Perhaps doing that only if GCC is detected.
Fixing it "your way" should certainly be possible, it looks like some quoting issue.
Sounds like you have a double-eval issue if your example doesn't work. If you can't figure out why that is happening you can try using gcc's -include
or -imacros
option. You would create a new file gcc_extra_definess
with the #defines
you want to add, and call gcc -include gcc_extra_defines ...
to get gcc to read that file and include it before reading the source file. This is a bit easier than a bunch of -D
options for defining multiple things, particularly if you have quoting issues or want things other than macros.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With