Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Error Message (http://www.chiefdelphi.com/forums/showthread.php?t=24312)

Obi 24-01-2004 15:45

Error Message
 
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

Re: Error Message
 
Quote:

Originally Posted by Obi
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
Code:

#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

Re: Error Message
 
This doesnt have to do with the function being prototyped, but when it works, you will need to change your statement to:

Quote:

Originally Posted by Obi
printf("Seconds: %d \n",(int)seconds);

Otherwise you will not get the value that you want.
--Damian Manda

echos 24-01-2004 18:44

Re: Error Message
 
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

Code:

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


Jay Lundy 24-01-2004 20:10

Re: Error Message
 
The syntax error has already been pointed out. Damian was just pointing out a much harder to find logic error.


All times are GMT -5. The time now is 09:02.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi