Sunday, August 2, 2009

In the language c of computers, can we include the .ccp files thru the #include preprocessor directive?

language of c plus plus....exclusively for the computer language oriented people.....


the #include directive is used to include the header files in the program......but can we include the .cpp files too???

In the language c of computers, can we include the .ccp files thru the #include preprocessor directive?
As far as I know you can include any file as long as it is well written I always include my own libraries and it cause me no problem at all and it gives a better and clearest idea of what you're doing
Reply:No we can't include a cpp file in c because c++ programs is derived from c he knows much of the c and a c programs insense can be a c++ programs but the C doesn't know about C++ because its is made after that .. So a C Code can be included in CPP programs but a CPP code can't be included in c ..











Thanks


suraj Sharma


http://cutesun.1gb.cc
Reply:You cannot include .cpp files in a C program. However, if you have a C++ application and would like to use C header files, you can simply use the extern "C" construct. Place this in your header file, but be sure to wrap the construct around an ifdef __cplusplus{} so as not to confuse any compilers which call the same header file as a C compiler will not understand the extern "C" construct.


No comments:

Post a Comment