Rate This Document
Findability
Accuracy
Completeness
Readability

The Implementation of built-in includes Varies According to Compilers

Error Information

error: typedef redefinition with different types ('__uint64_t' (aka 'unsigned long') vs 'UINT64' (aka 'unsigned long long')) 
error: unknown type name 'wchar_t'

Problem

Some header files (for example, stdatomic.h and stdint.h) are implemented by the compiler. The implementation of these files varies according to compilers. Therefore, after programs that are implemented using GCC header files are switched to Clang, the user-defined code may conflict with Clang header files.

Take redefinition as an example. Some variables are defined in some Clang header files but are not defined in the corresponding GCC header files. However, these variables are also defined in the header files of other libraries that are written or imported by the user. As a result, these variables are repeatedly defined, causing redefinition errors.

Another example is that some variables are defined in GCC built-in header files but are not defined in the corresponding Clang header files. When these variables are directly used in code written by the user, the unknown type error is reported.

Solution

You are advised to modify source code.