include EDK2 UefiSpec.h cause "error: unknown type name ‘UINT8’"

129 Views Asked by At

I'm trying to build a hello world c program to run on UEFI referencing EDK2 headers https://github.com/tianocore/edk2/tree/master/MdePkg/Include

I've git clone the repo, copied the folder above in my project directory and included as

#include <stdint.h>
#include <inttypes.h>
#include <stddef.h> // NULL

#include "./Include/Uefi/UefiSpec.h"
#include "./Include/Uefi/UefiBaseType.h"
#include "./Include/Base.h"
#include "./Include/X64/ProcessorBind.h"
#include "./Include/Protocol/LoadedImage.h"

// EFI Image Entry Point
EFI_STATUS EFIAPI efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
...

Here's my build command

x86_64-w64-mingw32-gcc -Wl,--subsystem,10 -e efi_main -I "./Include" -std=c17 -Wall -Wextra -Wpedantic -mno-red-zone -ffreestanding -nostdlib

And I get pages of errors like

./Include/Uefi/UefiInternalFormRepresentation.h:2095:3: error: unknown type name ‘UINT8’
 2095 |   UINT8    SkipCount;
      |   ^~~~~

the UINT8 is defined in "Include/X64/ProcessorBind.h" which is included

///
/// 1-byte unsigned value
///
typedef unsigned char UINT8;

Any idea?

Thank you

0

There are 0 best solutions below