![]() |
how to address warnings?
I use gcc to compile a .c file and get the following warnings when I execute the make file:
gcc -c -std=c99 gps2.c gps2.c: In function 'run_gps2': gps2.c:253:5: warning: implicit declaration of function 'localtime_r' gps2.c:257:5: warning: implicit declaration of function 'asctime_r' gps2.c:274:13: warning: implicit declaration of function 'strerror_r' gps2.c:348:21: warning: implicit declaration of function 'timersub' gps2.c: In function 'get_GPRMC_record': gps2.c:1397:17: warning: implicit declaration of function 'strsep' I have the following includes at the top of gps2.c: #include <string.h> #include <time.h> How do I address these warning? When I compile with g++, I don't get these warnings, however, I need to use gcc, not g++: e.g. g++ -c gps2.c Thanks much! |
Hi -
Code:
// PROBLEM:Code:
// SOLUTION:SUGGESTION: Look at /usr/include/string.h (for example): Code:
#if defined __USE_XOPEN2K || defined __USE_MISC1. Try compiling *without* the "c99" (if possible) 2. Try different combinations of "-D" |
> 1. Try compiling *without* the "c99" (if possible)
The problem goes away when the c99 option is not used. I used that option because it allows me to declare a variable in a for loop statement. for (int i = 0; i < x; i++) I've changed my code so that I can live without the c99 option. The warnings are rather quirky if the c99 option causes them. Thanks for your suggestions. |
| All times are GMT -5. The time now is 04:45 AM. |