I have an error message "warning :incompatible impicit declaration of built-in function printf" which gave me a headache till I tried the program and it worked anyway.
can anyone tell me what the message means or where to find out thanks.
I have an error message "warning :incompatible impicit declaration of built-in function printf" which gave me a headache till I tried the program and it worked anyway.
can anyone tell me what the message means or where to find out thanks.
For the headache, take an aspirin, drink some water, sleep, and call me in the morning.Originally Posted by mad_muppet
Does your warning message also include or highlight the line number it's referring to?
It's a witch to debug code that you can't see!
Since the 'f' and 't' are typed by the same finger maybe you have a typo, or ?
You have a built in function printf in stdio.h, and now you've got something else which also has the word or term "printf", in it, implicitly declared in your program.
Search and destroy is your mission.
And if you want help with code, or compiler complaints, please post the relevant parts inside code tags. My ability to read the minds of strangers is about as good as you'd guess it to be.
Adak
its a work in progress ..
the warning is line 18 warning: incompatible impicit declaration of built -in function printf and the same warning again for line 21.Code:int comp( double r, double i ) { double rr; /* temporary real number variable */ double ii; /* temporary imaginary number variable */ int count = 1; /* how many times iterated before number excedes terminal value */ int max = 3; /* maximum number of iterations before deciding number belongs in the mandelbrot set */ do{ rr = r * r - abs ( i * i ); ii = 2 * r * i; r = rr; i = ii; count++; } while ( count <= max && (( r + i ) < 4)); if ((( r + i) >= 4)){ printf(" out %d",count); } else{ printf(" in "); } }
sorry for posting twice missed the += while reassigning r and iCode:int comp( double r, double i ) { double rr; /* temporary real number variable */ double ii; /* temporary imaginary number variable */ int count = 1; /* how many times iterated before number excedes terminal value */ int max = 3; /* maximum number of iterations before deciding number belongs in the mandelbrot set */ do{ rr = r * r - abs ( i * i ); ii = 2 * r * i; r += rr; i += ii; count++; } while ( count <= max && (( r + i ) < 4)); if ((( r + i) >= 4)){ printf(" out %d",count); } else{ printf(" in "); } }
Well you could try
#include <stdio.h>
which is where printf() will be declared.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
so its there just not in the piece of code the warning gave as the problem area
So did you include stdio.h or not?Originally Posted by mad_muppet
If that header file was included at the top of your program, and the stdio.h file is in the right directory and can be read ok by the OS, then I don't see why you would get this warning.
It sounds like the header file was misspelled or couldn't be found in the directory where your compiler was looking.... but then why would it print your output ok?
(do check your "directories" options)
Perhaps it's smart enough to give you the warning, but continue looking for the header files in some other directories, and subsequently found it?
That would be clever!
Glad it all worked, anyway.
Adak
Or maybe our little friend was lazy to #include the stdlibs and the nice compiler caught it and put the stdlibs in anyway... gcc does that to some extent, for example.
Code:#include <stdio.h> void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){ puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9 /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i] ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][ t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}