I'm using DevC++ 4.0 on XP and somtimes when i call functions without the library i get an implicit declaration error and sometimes i don't. Are there any reasons for this anyone knows of?
I'm using DevC++ 4.0 on XP and somtimes when i call functions without the library i get an implicit declaration error and sometimes i don't. Are there any reasons for this anyone knows of?
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun
You should always #include the correct libraries.
Sometimes including one library includes the desired one for you, which can give you the impression you've done it right, when you actually you haven't.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
If you call a function without a declaration in scope then you're asking for trouble. Be sure to include the header for the library and the question is moot.
My best code is written with the delete key.
Try compiling this codeif you use gcc -o test test.c it will compile but if you use gcc -o test test.c -Wall -pedantic it won't. If your compiler is picky it'll ask you. If it isn't it won't work. You should always #inlcude the correct librariesCode:int main(void){ printf("Hello World\n"); return 0; }
The compiler will assume the function being declared implicitly returns an int, it might have disastorous conquences for functions like malloc
The one who says it cannot be done should never interrupt the one who is doing it.
I guess that answers that: just include the libraries and shut up.
![]()
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun