ajlu wrote:
I have a large program with many function. I dont know whether the
functions are properly coded or not. So I wish to compile a single
function without any header files presented in the main. Just i wish
to check the function whether it is logically ok or not. Is there any
compiler option available in gcc/g++.
This is pretty dicey. Sometimes programmers test functions in
standalone fashion using a "driver". That's a small main that is
compiled with the function in question, whose sole duty is to call and
receive returns from the function(s) under test. Usually different data
patterns are sent to verify the functions works per specification.
This is done sometimes when certain functions are written separately
while the rest is still be designed. It's sort of the opposite of
stubbing functions, which is where a dummy function with the correct
signature is inserted before the real one is written.
You will of course need any required headers, and the function under
test can't rely on any of the rest of the real program (other than
libraries you may be including).
Brian