Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: unknown type name 'bool' #31

Closed
michkowalczuk opened this issue Dec 13, 2023 · 4 comments
Closed

error: unknown type name 'bool' #31

michkowalczuk opened this issue Dec 13, 2023 · 4 comments

Comments

@michkowalczuk
Copy link

How to configure Chet if header uses bool type, but it does not define #include <stdbool.h>
For the example code:

struct IsLicense {
  bool is_licensed;
  char error[10];
};

Chet returns the following error:
error: unknown type name 'bool'

@neslib
Copy link
Owner

neslib commented Dec 13, 2023

C doesn't have native support for bool. So the header file must include <stdbool.h> (or another include file that includes <stdbool.h>

@michkowalczuk
Copy link
Author

After adding #include <stdbool.h> to the source code I get the following list of errors:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\yvals_core.h:29:2: error: Error in C++ Standard Library usage
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\xkeycheck.h:54:2: error: The C++ Standard Library forbids macroizing the keyword "bool". Enable warning C4005 to find the forbidden define.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\xkeycheck.h:234:2: error: The C++ Standard Library forbids macroizing the keyword "false". Enable warning C4005 to find the forbidden define.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\xkeycheck.h:439:2: error: The C++ Standard Library forbids macroizing the keyword "true". Enable warning C4005 to find the forbidden define.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\yvals_core.h:829:1: error: use of undeclared identifier 'EMIT'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstdint:21:1: error: unknown type name 'namespace'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstdint:21:1: error: expected ';' after top level declarator
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstdlib:23:62: error: expected function body after function declarator
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstdio:33:1: error: unknown type name 'namespace'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cstdio:33:1: error: expected ';' after top level declarator
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cwchar:22:1: error: unknown type name 'using'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cwchar:22:19: error: unexpected type name 'mbstate_t': expected expression
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cwchar:24:1: error: unknown type name 'namespace'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\cwchar:24:1: error: expected ';' after top level declarator
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\limits:37:1: error: unknown type name 'namespace'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\limits:37:1: error: expected ';' after top level declarator
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\yvals.h:346:1: error: unknown type name 'namespace'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\yvals.h:346:1: error: expected ';' after top level declarator
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\vcruntime_exception.h:28:5: error: unknown type name 'EMIT'

@neslib
Copy link
Owner

neslib commented Dec 14, 2023

If I create a header file with the #include <stdbool.h> and your sample struct, it translates just fine.
The errors seems to indicate that the header files use C++ instead of C. Chet only works with C.

@michkowalczuk
Copy link
Author

michkowalczuk commented Dec 14, 2023

Thank you. I found that a few of headers use C++ code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants