Reputation: 93
when compiling in VS i get no error but with gcc i get the following:
warning: format ‘%Lf’ expects argument of type ‘long double *’, but argument 2 has type ‘double *’ [-Wformat=]
scanf("%Lf",&checkprice);
^
/tmp/cch8NUeU.o: In function `main':
test.c:(.text+0x8e1): undefined reference to `stricmp'
collect2: error: ld returned 1 exit status
I guess this is normal. How can i fix it in gcc?
Upvotes: 3
Views: 346
Reputation: 53016
stricmp()
is not a standard function, though there is a POSIX equivalent strcasecmp()
so for your code to compile seamlessly with both compilers you can add something like this
#ifdef __GNUC__
#define _stricmp strcasecmp
#endif
and use _stricmp()
since stricmp()
was deprecated.
Also fix the scanf()
format specifier, or change the destination variable type to long double
.
Upvotes: 5