Skip to content

Fix compilation error related to argparse - #9

Open
WildBunnie wants to merge 1 commit into
cobilab:masterfrom
WildBunnie:argparse-error
Open

Fix compilation error related to argparse#9
WildBunnie wants to merge 1 commit into
cobilab:masterfrom
WildBunnie:argparse-error

Conversation

@WildBunnie

Copy link
Copy Markdown

Attempting to compile GTO with gcc version 16 causes an compilation error related to incompatible pointer types.
I'm currently using gcc 16.1.1 20260625 and attempting to compile using make leads to the following error:

gcc -c -O3 -Wall -ffast-math -msse2  -D LINUX argparse.c
argparse.c: In function ‘argparse_parse’:
argparse.c:271:16: error: assignment to ‘const char **’ from incompatible pointer type ‘char **’ [-Wincompatible-pointer-types]
  271 |     self->argv = argv + 1;
      |                ^
argparse.c:272:16: error: assignment to ‘const char **’ from incompatible pointer type ‘char **’ [-Wincompatible-pointer-types]
  272 |     self->out  = argv;
      |                ^

Attempting to compile it in other machine with an earlier version of gcc (13.3.0) allowed it to compile with this issue being marked as an warning instead of an error. This means that newer versions of gcc are probably stricter with this specific type of issue.

This pull request fixes this issue by making the argv and out members of the argparse struct not be marked as const, as they are being altered by the code that causes the issue.

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.

1 participant