Skip to content

Updated MakeFile for compatability with linux mint#16

Open
EdgeCaseBerg wants to merge 1 commit intoseenaburns:masterfrom
EdgeCaseBerg:updated-makefile
Open

Updated MakeFile for compatability with linux mint#16
EdgeCaseBerg wants to merge 1 commit intoseenaburns:masterfrom
EdgeCaseBerg:updated-makefile

Conversation

@EdgeCaseBerg
Copy link
Copy Markdown

-c99 for the standard causes the code to fail with an implicit
declaration of the function strsep as well as errors from atoi making a
pointer from an integer without a cast. Updating the makefile to use the
gnu99 standard resolves these errors.

For reference:

uname -a
Linux Turing 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

-c99 for the standard causes the code to fail with an implicit
declaration of the function strsep as well as errors from atoi making a
pointer from an integer without a cast. Updating the makefile to use the
gnu99 standard resolves these errors.
@seenaburns
Copy link
Copy Markdown
Owner

This feels like an indirect way of addressing the problem, is there a way of fixing the code itself to compile on Linux Mint? Or would it compile without -Werror?

I haven't heard of people experiencing this problem before, so I'd prefer to make smaller changes, in case changing the standard introduces new issues.

@EdgeCaseBerg
Copy link
Copy Markdown
Author

This is the full error from trying to run make

cc -Wall -Werror -Wextra -std=c99 -pedantic -Wno-unused-parameter stag.c view.c data.c -o stag -lncurses -lm -D_DEFAULT_SOURCE 
stag.c: In function ‘main’:
stag.c:131:11: error: implicit declaration of function ‘strsep’ [-Werror=implicit-function-declaration]
stag.c:131:11: error: passing argument 1 of ‘atoi’ makes pointer from integer without a cast [-Werror]
/usr/include/stdlib.h:148:12: note: expected ‘const char *’ but argument is of type ‘int’
stag.c:132:11: error: passing argument 1 of ‘atoi’ makes pointer from integer without a cast [-Werror]
/usr/include/stdlib.h:148:12: note: expected ‘const char *’ but argument is of type ‘int’
cc1: all warnings being treated as errors
make: *** [stag] Error 1

Removing -Werror will allow it compile with warnings, but if you ask me removing -Werror is worse than updating to a different standard.

The issue is that strsep is not a POSIX or Linux standard function, it's a BSD function. So on ubuntu and other non-bsd code it won't work unless you use the gnu99 standard

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