Tuesday, July 14, 2009

Needed clarification in C and C++..?

Can i make the my user defined function as a part of C or C++ library? If so please guide me the procedure..


Can i define my own pre-processor directive and place my user-defined function in that directive?..Please tell me the procedure too..


Thanks..

Needed clarification in C and C++..?
Make a file called abc.h





Put your function in it.





Include abc.h into your source file using the preprocessor directive:- #include "abc.h"





If abc.h is in the same directory as C/C++ source file no need to give path else give path.
Reply:Create a file filename.c that includes your own functions, but without a main() function being defined.


Compile it. An error appears saying "main moudule


missing."


This indicates that .obj file of your C program is created.


Now you can use #include "filename.c" as a header.


See to that your filename.c file is placed in the current directory.


Thank you.

baseball cards

No comments:

Post a Comment