Log in

View Full Version : Error Message


Obi
24-01-2004, 15:45
I'm getting the following error message:
"Warning [2058] call of function without prototype" when I try to do the following code:
printf("Seconds: %d \n",seconds);
Problems?

doy
24-01-2004, 16:19
I'm getting the following error message:
"Warning [2058] call of function without prototype" when I try to do the following code:
printf("Seconds: %d \n",seconds);
Problems?
you need to put

#include "printf_lib.h"

at the beginning of every file that you want to use printf in, or else the compiler will yell at you like that.

Damian Manda
24-01-2004, 16:54
This doesnt have to do with the function being prototyped, but when it works, you will need to change your statement to:


printf("Seconds: %d \n",(int)seconds);
Otherwise you will not get the value that you want.
--Damian Manda

echos
24-01-2004, 18:44
Type casting is not the problem here. Even if the type cast is wroung the program will still compile, you'll just get undesired results thats all. Kinda like this


Printf("4 + 4 = %d");
//this could return anything like "4 + 4 = 4098
//now how did that happen?

Jay Lundy
24-01-2004, 20:10
The syntax error has already been pointed out. Damian was just pointing out a much harder to find logic error.