Skip to content

Comments

Add missing #include <stdbool.h>#36

Merged
Pansanel merged 3 commits intomychem:masterfrom
merkys:add-stdbool
Jan 30, 2025
Merged

Add missing #include <stdbool.h>#36
Pansanel merged 3 commits intomychem:masterfrom
merkys:add-stdbool

Conversation

@merkys
Copy link
Contributor

@merkys merkys commented Jan 30, 2025

GNU 14.2.0 CXX compiler on Debian unstable complains about missing #include <stdbool.h> in a bunch of *.h files, for example:

[ 27%] Building C object src/CMakeFiles/mychem-lib.dir/property.c.o
In file included from /home/andrius/src/mychem-code/src/property.c:30:
/home/andrius/src/mychem-code/src/property.h:47:1: error: unknown type name ‘bool’
   47 | bool molweight_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
      | ^~~~
/home/andrius/src/mychem-code/src/property.h:36:1: note: ‘bool’ is defined in header ‘<stdbool.h>’; this is probably fixable by adding ‘#include <stdbool.h>’
   35 | #include <mysql.h>
  +++ |+#include <stdbool.h>
   36 | #include <ctype.h>
/home/andrius/src/mychem-code/src/property.h:74:1: error: unknown type name ‘bool’
   74 | bool exactmass_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
      | ^~~~

This PR makes mychem-code compile successfully for me.

@merkys merkys changed the title Add missing #include <stdbool.h>. Add missing #include <stdbool.h> Jan 30, 2025
@Pansanel Pansanel self-assigned this Jan 30, 2025
@Pansanel
Copy link
Contributor

Thanks for reporting the issue. Is it not sufficient to add the missing header only in the header files?

@merkys
Copy link
Contributor Author

merkys commented Jan 30, 2025

Thanks for reporting the issue. Is it not sufficient to add the missing header only in the header files?

Good point, I have not tried that, I directly followed GCC advice. Will check.

@merkys
Copy link
Contributor Author

merkys commented Jan 30, 2025

You were right, it is enough to add the missing header to header files.

@merkys
Copy link
Contributor Author

merkys commented Jan 30, 2025

Updated the PR accordingly.

@Pansanel
Copy link
Contributor

The file property.c still includes stdbool.h. Can you please remove it?

@merkys
Copy link
Contributor Author

merkys commented Jan 30, 2025

The file property.c still includes stdbool.h. Can you please remove it?

Good catch, removed.

@Pansanel
Copy link
Contributor

I thank you for your contribution. I can merge this PR.

@Pansanel Pansanel merged commit 60c1560 into mychem:master Jan 30, 2025
3 checks passed
@merkys merkys deleted the add-stdbool branch January 31, 2025 07:38
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

Successfully merging this pull request may close these issues.

2 participants