The compiler needs both files in order to create object code of them, if you only feed it one file the second won't be compiled and hence the linker will complain that it can't find the function in that file.
Yes, it causes all the files in the project to be compiled for you.
Some compilers even have functions to check if a file was modified and if not, it won't recompile it again, resulting in faster compilation while develloping.
On a sidenote, Dev C++ is really unpopular as an IDE because it's quite old and apparently has many flaws, though note that I've never used it myself.
As an alternative, I hear many good things about Code::Blocks - though I don't use that myself either.
Dev-C++: it has over 300 bugs that have not been fixed, it has not had its MinGW updated in something like 10 years, if you look in the articles section, there is a rant about it.
Code::Blocks: it is new, its interface is shiny, it has daily bug fixes published, and it is just as free as Dev-C++.
When in Code::Blocks (just dump Dev-C++), you make a project, make a new header and .cpp file besides main.cpp (it will automatically prompt you and ask if you want to add it to the porject--you do), and then compile the project (which, as a side note, is the only thing you can compile while a project is open, so be careful).
First of all, Thank you Everyone for sharing this useful info.
I know dev C++ is outdated, but I only use it because its easy to use. I tried to use Microsoft Virtual C++ Ide but I could not figure out how to use it. I also tried using eccipse for C\C++ but it keeps on giving me some error like ''could not find binary''. while learning 'C' I used to work with Turbo C++,it was a nice ide. I have'nt tried code::blocks but will surely try it.. Thanks again.